Hardware platform details, the last column is the product of the two previous columns – you must use a machine with at least 4 total threads (i.e., TT, # OF CORES x # THREADS PER CORE >= 4). Java will report these as “cores”. All of your trials must be done on the same machine without any other programs running to avoid throwing off your results/analysis.
TOTAL RAM (GB) CPU MODEL # OF CORES # THREADS PER CORE TOTAL # OF THREADS (TT)
You have to pick a value for your upper limit (N) that takes about 3 minutes to run with a single thread, i.e., command line args are 0 and N, and then use it for your 5 runs (you may have to do some experimentation to find that value). All run in the bash shell using the time command.
Here is an example of one set of runs to help you. My N is 1,200,000 , and trial #5 is done with 1.5 x TT (e.g., I have 4 total number of threads – reported as cores by Java, so I created 6 threads via command line arguments). My first run defines what 100% is, the other values are computed by dividing the total seconds against the total seconds of the first trial (182 in my case).
Note: Trial # 4 uses command line args 0 to N/2 and N/2 to N, trial #5 repeats args 0 to N TT x 1.5 times.
Use this form to record your information – I’ve filled in much of your information already.
N (runs for @ 3 minutes) = ___________ Total # of Threads (TT) = ___ TTx1.5 = _______
# Threads Args Trial Mins Secs Total Secs Percent
1 0 N #1 100%
2 0 N 0 N #2
3 0 N 0 N 0 N #3
2 0 N/2 N/2 N #4
TT x 1.5 0 N x (TTx1.5) #5
Answer these as clearly and succinctly as possible. Add your answers below each question. Answers that are clear, organized and non-rambling will earn you more points that those that are. When comparing you’ll be referring to percentages generally.
1. Did you get similar results in terms of percentages as show in the example? Why/Why not – what do you think?
2. In the example shown (and perhaps your own), why do you think trials #2 and #3 take more time than #1 – shouldn’t they be close in time? What did your runs show? What do you conclude?
3. In the example, why does trial #4 not take close to half the time of #1? After all you have two threads doing the work of one? ( <- I consider this probably the most important question)
4. In the example, why is trial #5 so much worse?
5. What happens if you comment out the code that executes the .join() calls? Carefully explain. Provide a pair of screenshots that show a simple example (once with and once w/o join()) using three threads? Paste them right below, you’ll be pasting other runs in Part III.
Screenshot with join() using 3 threads
Screenshot without join() using 3 threads repeating above command line arguments
5 freelancers are bidding on average ₹335/hour for this job
Hi, I'm a software architect and Java developer. I have no problem working on your projects as you specified. Please contact me and I look forward to hearing from you soon!