Re: JavaMemoryModel: JMM on clusters

From: Bill Pugh (pugh@cs.umd.edu)
Date: Fri May 26 2000 - 07:11:21 EDT


At 12:12 AM -0400 5/26/00, Patrick Doyle wrote:
>I had a thought about the Java Memory Model on a cluster. Suppose one
>thread accesses a variable. Then it will have that variable in its local
>memory. Then, suppose another thread on the *same node* wants to access
>that same variable. It would be nice if it could use the same copy as the
>first thread, because it has access to the same local memory (being on the
>same node).
>
>However, you can't let this happen. Suppose A1 and A2 are two threads on
>one node, and B is a thread on another node. You could get a trace like
>this:
>
> A1 A2 B
> a(x)1 u(x)1 u(x)0
> a(y)1 u(y)0 u(y)1
>
>(where "a" is "assign" and "u" is "use").
>
>This is illegal with the JMM because the main memory is (I think) supposed
>to serialize all writes, and there is no sequence that could produce these
>values.

Sure it can. I've used standard r/w notation here.

        A1 A2 B
                        r(x)0
        w(x)1
                r(x)1
                r(y)0
        w(y)1
                        r(y)1

It looks like you are using notation from the old JMM (read, load,
use; assign, store, write). Don't. A lot of people (including the
authors of the JLS) have reached general agreement that the old JMM
spec was very confusing and doesn't mean what the authors intended it
to mean.

As far as the revised spec, I am arguing that we should enforce
little more than release consistency (with some added stuff for
volatile, final fields, type safety, ...). So doing a cluster or even
a DSM implementation of Java shouldn't be impossible.

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