Re: JavaMemoryModel: The Optimistic Read Idiom and the new Java Memory Model

From: Doug Lea (
Date: Tue Oct 31 2000 - 12:50:24 EST

> My interest is in having a simple model that is easy to explain. I
> don't want the system to support any ugly hacks that would be
> erroneously used 95% of the time.

The natural followup question here is: Is there something that can be
done to make the story on basic semantics simpler, and still let
experts do what they want (even if it means experts must write weird,
error-prone, arbitrarily ugly code)?

Every time this issue has come up, the only plausible candidate that
arises is to introduce "magical" classes and methods into java.lang ,
for example a MemoryBarrier class (we had a similar set of exchanges
on classes supporting compareAndSwap), but for some reason, the idea
never goes further. The main advantage is that such classes reduce
pressure on other constructs to get particular effects. The main
disadvantage is that they cannot be defined or explained within the
context of the rest of the memory model. But maybe this is better than
the alternatives?

Doug Lea, Computer Science Department, SUNY Oswego, Oswego, NY 13126 USA 315-341-2688 FAX:315-341-5424  
JavaMemoryModel mailing list -

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