JavaMemoryModel: Explaination of litmus test V4

From: Bill Pugh (pugh@cs.umd.edu)
Date: Thu Mar 23 2000 - 17:49:30 EST


In conversations off-line with Doug, it is becoming apparent that
test V4 is rather confusing. Let me try to explain what I am trying
to check for.

For a number of purposes, it would be nice to guarantee that if you
read a volatile field and got a reference to an object, you saw fresh
values for the fields of that object. This is what is tested by V3.

In order to do this, writing to a volatile variable must some other
variables to be flushed to main memory, and reading a volatile
variable must force the reloading/reconciliation of some variables.

So if I load a volatile reference p, what other variables need to be
reloaded/reconciled? The options include:

        * All non-final variables (enforces V3-V6)
        * All fields/elements in objects reachable from p
                (enforces only V3 - V5)
        * All fields/elements in the object referenced by p
                (enforces only V3 & V4)
        * All fields/elements loaded directly or indirectly through p
                (e.g., p.next.x)
                (enforces only V3 and V5)
        * All fields/elements loaded through p (enforces only V3)

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