JavaMemoryModel: Loosing the global ordering

From: Bill Pugh (pugh@cs.umd.edu)
Date: Tue Oct 26 1999 - 16:51:21 EDT


> > The model is that you have a global system that, in each
> > step, executes one operation from one thread. Thus, there
> > is a total order over the execution of all operations.
>
>Why make this assumption? You don't seem to depend on it? It seems like
>this could introduce accidental properties into the semantics that you
>don't really intend.

I had done this initially, because I had wanted to avoid any
mentioning of control and data dependences in the model.

I don't like including them in the model, for a couple of reasons:

* A compiler can never know them exactly, you can only approximate them. Since
        different compilers might approximate them differently, does that mean
        that different compilers give you different semantics?
* Java has exceptions, and exceptions make control dependences a mess. For
        example, consider the following code. Initially, Foo.p and Foo.q are
        both null.

        Thread 1 Thread 2

        Foo.p.x = 0 Foo.q.x = 0
        Foo.q = new Point() Foo.p = new Point()

   These is really the same as:

        initially, Foo.p = Foo.q = 0

        Thread 1 Thread 2
        if (Foo.p) if (Foo.q)
            Foo.q = 1 Foo.p = 1

According to the standard definition of a data race, neither of
these examples has a data race and the assignments to p and q won't
happen.

But even though I don't like including them in the model, I may need to.
Otherwise, you can't reorder a read and a following write. In email
with Sarkar and Gao, they clarified that Location Consistency does
allow reordering of actions within a thread as allowed by control and
data dependences, so it looks like I will have to done something like
that as well.

More soon.

        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:21 EDT