We are looking multithreading program with BigInt in Java and C++
I have attached my C++ file([login to view URL]) and Java codes([login to view URL]).
In C++ files, I couldn't increase while loop in line 284 ~ 345. I
think I got a wrong method used to increase a Big Integer.
In my Java codes, you can read my descriptions. As I discussed it,
there are some problems to run multi-threads in some while loop
between line 94 ~ 154 in [login to view URL] file.
Every code is working on the terminal mode, and you have to install
Cygwin C++ compiler.
1. Purpose - to find the optimal bit size as below:
T = A * B^X + R, ex.) 16402=1*2^14+18=1*4^7+18
if the bit size of T is 15 bits(16402), A=1(1bit), B=4(3 bits), X=7(3 bits) and R=18(5 bits), then total size will be 12 bits=1+3+3+5 for the optimal case. Therefore there is 3 bits benefits than original bits.
2. For finding the optimal case, I set my algorithm concept as below:
- There is 4 variables : A, B, X, and R
- So, each variables size will be 1/4 size of the original bit size.
ex.) 1<=A<=(12/4) size, 2<=B<=(12/4), 1<=X<=(12/4) and R will be same to X, but actually we don't care the size of R because we have the above formula already.
- Additionally, to apply multi-thread to this algorithm, I divided the size of X as much as the number of threads with two variables as min, max. For example, if total threads are 3, X will be from 1 to (2^3+2^2+2^1).
So, the first thread will have the range 1~1*((2^3+2^2+2^1)/3).
The second thread will be 1*((2^3+2^2+2^1)/3) ~ 2*((2^3+2^2+2^1)/3)
and the last one will be 2*((2^3+2^2+2^1)/3) ~ (2^3+2^2+2^1).
- If you find all of cases to satisfy the avobe formula for each A, B, X and R, you should compare them each other and have to choice the most small size of combination to satisfy the avobe formula for each A, B, X and R.
3. In my java codes, I made it similary, but I found my division part of X was something wrong,
And now, I'm trying to fix it. Also, I appied multi-thread but it looks like the only one thread works.
Actually, it's not true. I checked them and found all threads are running correctly, but, I failed to divide the range of X, and other threads are done quickly and it looks they didn't work.
In my opinion, it looks like about the load balancing of the range of X, but currently, I got wrong way.
Please, just do refer to my codes, and make it enhance them.
4. How to compile and run:
- javac *.java
- java goalJavaExp
10 freelancers are bidding on average $124 for this job
Hi! My name is Ihor, I will be glad to help you I have strong experience in C# and Java Android development for 3+ years. Feel free to contact me any time to discuss details.
Hello, client. I'm a Java expert with full experiences. Please check my reviews. I will complete it in 2 days. I can finish your project wonderfully. Thanks.
Hi, how are you. Glad to meet you. I have long experience with C++ and java programming. I am sure you are fully satisfied with me in this project. I have already a experience with Big Integer. I hope your response.