Re: JavaMemoryModel: javaworld on double-check

From: Clifford Click (
Date: Mon Feb 12 2001 - 12:53:04 EST

Doug Lea wrote:

> See
> "Double-checked locking: Clever, but broken"
> -Doug
> -------------------------------
> JavaMemoryModel mailing list -

Yeah! A little more sanity in the world!

Now on to my real reason for posting. I'm busy trying to make HotSpot
safe for the new JMM and I'm staring at how we do synchronization. We
use a CAS-style instruction on both Sparc and Intel; both are atomic
unto themselves but neither make any multi-cpu guarentees. Do I need
a multi-cpu guarentee at locks and unlocks? (assuming Sparc TSO and
whatever passes for standard on multi-cpu intels). I afraid of what the
performance hit will be when I insert a MEMBAR at each lock and unlock!

And if I need one, can one of you brilliant gentlemen provide me with a
program which clearly breaks if I lack such a thing? I'm more than happy
to help you write loops which are "too clever" for HotSpot to optimize
(note that the current CoherenceVolatile test "disappears" before ever
getting around to testing volatile coherence).


Cliff Click                  Compiler Designer and Researcher
cliffc at            Java Software
(408) 863-3266               MS UCUP02-302

------------------------------- JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:30 EDT