Updated pi_threaded.java

I updated the pi_threaded.java script that I presented in lecture today to scale to N processors. I then ran it on my 8-core Mac desktop machine. Here are the numbers. The single threaded version ran in 17.7 seconds on the 8 core machine. As with my laptop this morning, it maxed out a single processor at 100% utilization during those 17.7 seconds. Then I ran the new version of pi_threaded.java set to make use of all 8 cores. It ran in 1.4 seconds. It executes so fast that Activity Monitor doesn't have time to report on CPU utilization. However, the output of the unix time command indicates that indeed all eight cores are maxed out during the roughly 1.4 seconds of execution:

real 0m1.437s
user 0m9.738s
sys 0m0.043s

Even though the command executed in 1.437 seconds, the CPU utilization was 9.738 meaning that each of the cores spent about 1.2 seconds working on their task. I have added the new, scalable version of pi_threaded.java to the Lectures page.
© Kenneth M. Anderson, 2010.