On Fri, 15 Feb 2002, Etienne M. Gagnon wrote:
> Have you heard of "thin locks" and other VM level optimizations that reduces 
> "significantly" the cost of locks?

Even the ideal lock still carries a large cost.  The CPU will probably
stall, flush its store buffer, reload values from memory, etc.
There's no escaping that.  (However I'm not sure if this is true when
reentering a lock already held by the current thread.)

> The "synchronize" will force the "current processor" to update its data 
> cache.

Most modern multiprocessors use hardware cache coherency (though the Java
memory model doesn't require this, and relying on it isn't a good idea).

More importantly, synchronization forces ordering of loads and stores.

My impression is that hardware cache coherency is a bad idea because it
gives programmers a false sense of security and may even limit the
scalability of SMP hardware due to the extra bus traffic required.  (I
wonder if anyone's tried Java on a NUMA architecture?)

> Mutiprocessors + threads => difficult programming.

Most definitely.

Jeff


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to