Bill Pugh wrote:
> I'd be more confident answering a test case. So let me propose one:
>
> Initially, x = 0
>
> Thread 1:
> x = 1
>
> Thread 2:
> x = 2
>
> Thread 3:
> r1 = x
> r2 = x
> r3 = x
> r4 = x
>
> Behavior in question: r1 = 0, r2 = 1, r3 = 2, r4 = 1
>
> Decision: Yes, this behavior is absolutely legal, even if you throw a
> pile a volatile accesses, dependences
> and synchronizations into thread 3 to try to keep the reads of x from
> being reorders (so long as thread 3 doesn't synchronize with threads 1
> and 2). In fact, thread 3 can also still see the value 0 for x, and x
> never has to stablize (unless, for example, thread 3 writes to x).
In fact this follows straight from the definition of the HB relation and
the visibility of writes at reads.
Therefore, semantics respecting HB (e.g. CCM, MPS) must show this
behavior, even if they differ on their treatment of conditional reads
and writes.
Best,
Vijay
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:00 EDT