× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You also have to remove the sleep from the second test, which would
reduce the elapsed time accordingly.

From my understanding the "sleep" is just to simulate the threads "doing
other stuff" such as waiting for a DB/disk/etc. to respond,


No, if you review the code in the Task class, you'll see that sleep() is
run only once at the entry point of the call() method - just prior to
executing the 20K loop. So the run / wait states illustrated in the
profiler evidently only account for the string concatenation performed in
the loop - which is very tight CPU bound code.

The sleep period evidently just enables all 50 Task thread instances to be
loaded so that they may run concurrently.

The author stated that he was using JProfiler, which is a JVM profiler,
which may not measure the actual CPU run / wait states, but rather measures
what the JVM is allowing to run, when.

The tests referenced in the article indicate that support provided by
java.util.concurrent
can "force" a JVM to utilize multiple cores - but at a HORRIBLE cost.

A Java nut might say, "Look ma, I can take a multi-threaded CPU bound
workload that would normally use 60% of one core for 15 seconds and force
it to use 100% of 8 cores for 11 seconds, and accomplish the same thing."

Then the nut would have to duck as his mother threw the rolling pin at his
head.

If this is the best Java can do, then I would have to agree with Ronald
Luijten that Java doesn't support multi-cores "at all".

Nathan.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.