Re: JavaMemoryModel: Explaination of litmus test V4

From: Doug Lea (
Date: Thu Mar 23 2000 - 20:09:06 EST

> 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.

OK. I think I get it. When, say, a local is bound to a volatile ref,
the contents accessed via the local need to be at least as fresh as
that read of the volatile. Yes? So...

Given field:
  volatile Node p;

And code inside some method:

  Node tmp = p; // (*)
  // ... possibly lots of unrelated code ...
  int i = tmp.x; // the value x is at least as fresh as it was at (*)

Right? In other words, assignments both to and from a volatile
reference (or array) field normally entail some sort of memory
synch operations.

JavaMemoryModel mailing list -

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