RE: JavaMemoryModel: Another litmus test for strong vs. weak volatiles

From: David Holmes (dholmes@dltech.com.au)
Date: Thu Mar 18 2004 - 17:21:45 EST


> Initially, x = y = v = 0, v is volatile
>
> Thread 1:
> x = 1
> v = 1
>
> Thread 2:
> y = 1
> v = 2
>
> Thread 3:
> r1 = v
> r2 = v
>
> Thread 4:
> r3 = v
> r4 = x
>
> ...
> So is there a happens-before edge from x = 1 to r4 = x? There is under
> the strong semantics, but not under the weak semantics.

Does this boil down to whether the two statements in Thread 3 can be
reordered?

Otherwise "roach motel" rules say r4 == 1

David Holmes

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