Re: JavaMemoryModel: Sequential consistency

From: Jeremy Manson (jmanson@cs.umd.edu)
Date: Thu Dec 09 2004 - 17:46:26 EST


Kevin Yip wrote:
> Hi,
>
> In "Fixing the Java Memory Model", Bill gives an example in Figure 1
> that an anomalous (non sequentially consistent) result can happen due to
> prescient store. I wonder whether this is actually possible. For the
> result to occur, the store of y by T1 has to be reordered before the
> read of y by T2, and the store of x by T2 has to be reordered before the
> read of x by T1. However, the second bullet of Seciton 17.8 of the Java
> Language Specification says that no load operations on the same variable
> should appear between an assign action and its corresponding reordered
> store action. This means the assign of y by T1 has to be before the load
> of y by T2, and the assign of x by T2 has to be before the load of x by
> T1, which is impossible.
>

ObRant: I wouldn't try to read too much into the original memory model.
  We spent several years trying to determine its implications, and
finally failed. It is unclear exactly what they are. As Bill will no
doubt say if we give him a chance, it is a waste of time to try to
figure them out.

Having said that, it is my understanding that 17.8 is not talking about
a single total order over all actions. The original memory model
doesn't have one (neither does ours). It is referring only to ordering
constraints over actions in a single thread. So you can't do any
reasoning about actions by other threads. It is nicely ambiguous,
though, isn't it?

> Anyone can point out any problem of my arguments?
>
> And more fundamentally, can we claim that the existing Java
> consistency model does not guarantee sequential consistency? Do we have
> other examples?

The new Java memory model IS the existing Java memory model. JSR-133 is
done. Signed, sealed, and delivered. The fact that people don't
consider it the existing one is simply a matter of the new JLS not
having been published yet.

The JMM does not guarantee sequential consistency. The old one didn't,
either, as above.

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



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