JavaMemoryModel: Total ordering of volatile memory operations

From: Bill Pugh (pugh@cs.umd.edu)
Date: Wed Aug 07 2002 - 22:56:58 EDT


Eliot,
   I think you may have taken some things the wrong way. I'm not sure
whether you are worried about the model as a whole, or about
volatiles in particular. We have always had a total order over all
operations in our model (for at least the past two years, at any
rate). The fact that operations occur in a total order doesn't
require that the system exhibit sequentially consistent behavior. The
only thing in the current proposal that really shows the effect of
the total order is volatile variables.

At 9:21 PM -0400 8/6/02, Eliot Moss wrote:
>The end result is that data races on non-volatiles would be pretty useless,
>since the resulting value could "fluctuate" (but only among the values
>written by the most recent unordered writes)

Yes, this is a part of the our current model.

At 9:21 PM -0400 8/6/02, Eliot Moss wrote:
>data races on volatiles
>would eventually give "stable" values, but not within any specific time
>period.

OK, let me try to clarify the volatile situation regarding volatiles.

The original JMM (in the JLS) clearly required that volatiles be
sequentially consistent.

The first versions of our models also required that volatiles be
sequentially consistent.

Based on input from Hans and and Rick Hudson, we produced a version
of our model that allowed a very limited relaxation of sequential
consistency for volatiles.

Sarita tells me that the relation that Hans and Rick advocated isn't
needed by any current or future architecture. Some implementations
would benefit from a greater relaxation, but Sarita didn't think the
minimal relaxation I had included previously would be helpful.

Declaring it not to be my area of expertise, I ask Sarita, Hans and
Rick to resolve the question via email. Those discussions have been
inconclusive.

In devising our revised model, Jeremy and I use the simple,
sequentially consistent semantics for volatiles, primarily because
they are easier to explain. However, we can easily change the revised
model to include the previous relaxation.

So....

We really need you, Hans, Rick and Sarita (plus who ever else wants
to jump in) to come to an agreement, or agree to disagree. Whatever
you decide, I can implement in the model. If it is a new relaxation
of sequential consistency (not the one we previously had used), I'll
have to try to find an appropriate formalization that fits in our
model.

The model should be as simple as possible, but no simpler. I would
prefer having sequentially consistent volatiles, because it allows a
simpler formalization. However, if a bunch of architecture/OS experts
all agree that something more relaxed is needed, we can consider
relaxing it (balancing it against the need for programmers to use
volatile variables to create reliable software).

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



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