Re: JavaMemoryModel: javaworld on double-check

From: Clifford Click (cliff.click@Eng.Sun.COM)
Date: Mon Feb 12 2001 - 12:53:04 EST


Doug Lea wrote:

> See
> "Double-checked locking: Clever, but broken"
> http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
>
> -Doug
> -------------------------------
> JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel

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

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

------------------------------- JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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