[concurrency-interest] Best CPUs for testing

Péter Kovács peter.kovacs at chemaxon.hu
Wed Dec 13 06:54:42 EST 2006


Hi,

A passage in "The Java Memory Model" section in "Concurrent Programming 
in Java" prompted me to ask the question: can the CPUs currently 
available on the market be ranked by their suitability for detecting 
concurrent programming problems. While I am certainly interested in the 
"theoretical" considerations of why a given CPU is better positioned for 
testing concurrent code than another, I would like to use such an 
ordered list to effectively pick an affordable CPU for my tests. (So 
there is a practical motivation to my question.)

A similar question may be asked about OSs -- but OSs are probably less 
relevant in this regard.

The following anecdote may be related to this question: I recently 
discovered a synchronization bug in our code using a single-core 
single-Opteron machine (i.e one core in total) with Solaris 10 which 
went undetected on various single-core or multi-core (including 
multi-processor) Intel architectures with Linux and Windows operating 
systems. The bug was not obvious, because for it to occur a highly 
unlikely scheduling of two concurrent threads was required (one of the 
thread was required to be suspended almost about half a second after it 
has been started -- with the other going ahead with its work and getting 
into a state as if it hadn't done any work yet and, as a result, getting 
into a deadlock with the other). In your experience, which one is more 
relevant: the peculiarities of the CPU or those of the operating system? 
Or may be the HotSpot compiler? Might there be platform specific 
optimizations by the HotSpot compiler at work here? (I am starting to 
see that it is not trivial to tell the effect of these factors apart, 
since for certain platforms [like Solaris] there may be not many JIT 
compiler implementations to test with -- apart from that of the OS 
vendor's.)

The passage in Doug Lea's book mentioned above is: "The use of common 
caches across threads sharing a CPU, the lack of aggressive 
compiler-based optimizations, and the presence of strong cache 
consistency hardware often cause values to act as if they propagate 
immediately among threads."

Does this mean that, for example, Intel Core Duo processors are likelier 
to bring a concurrency problem to surface than are Intel Core 2 Duo 
processors with cores of the former working from separate caches. (I may 
be confusing several things here. For example, I do not even now if the 
"shared cache" of the Core 2 Duo-s is the same kind of cache which is 
meant by the passage above. :-) )

Any comment appreciated.

Thanks
Peter


More information about the Concurrency-interest mailing list