JNI-performance - Is it really that fast?

Dave Dice Dave.Dice at Sun.COM
Wed Mar 26 23:20:48 UTC 2008

> Good to know, thanks for explaining.
> I don't want to steal your time, but, if its only a local thing why is
> my old pentium4 so much faster than my core2duo when it comes to
> cmpxchg?
> Sorry for asking that much...

No problem at all (:>).

Is your pentium4 a uniprocessor?  On uniprocessors HotSpot elides the  
lock: prefix when emitting the Intel cmpxchg (CAS) instruction.  The  
lock prefix forces the cmpxchg to be serializing and greatly increases  
the latency but that's unnecessary on uniprocessors as they're always  
self-consistent.  (Even multiple threads on a uniprocessor are always  
self-consistent with respect to the memory model).


More information about the discuss mailing list