JavaMemoryModel: Re: Roach motel ordering: Do we have consensus?

From: Joseph Bowbeer (
Date: Sat Jul 07 2001 - 20:39:59 EDT

Bill Pugh writes:

> I would like to try to get this settled so we can move on to other
> fun topics (like object initialization and final fields). David Holmes
> expressed some reservations, but generally people seem to be
> OK with "roach motel" ordering:

I also have reservations about "roach motel" ordering.

I'd rather err on the side of caution in this case. I'm also wondering just
how critical the performance of volatile is.

Note that we almost have a clean slate here, because volatile is almost
non-existent in real code (and behaves strangely -- if it behaves
differently at all).

I think we're envisioning several different uses for volatile:

1. Some of us want a more efficient mechanism than synchronized() for use in
concurrent utilities.

2. Others want a cheap way to fix old, broken code (e.g., JDK).

3. Others want a tool for naive programmers: "Just declare everything
volatile and your code will work as you think it should."

These are listed in order of decreasing performance requirements. Please
correct me if I've wildly mischaracterized this.

I'd be happy with a volatile that behaved like a miniature monitor
enter/exit. (At least I wouldn't have to worry about it not staying where I
put it..)

But if you want to move on and talk about other things, that's fine with me,

Joe Bowbeer

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

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