At 11:26 AM -0500 12/2/02, Doug Lea wrote:
>In the course of checking out things for the draft cookbook (which has
>already led to several small but important updates -- see
>http://gee.cs.oswego.edu/dl/jmm/cookbook.html), Jeremy Manson and I
>have been trying to verify the following property of
>multiprocessors. In psuedo-C:
>
> Initially, a == null, x == 0
>
> Thread 1 Thread 2
> x = 1 r1 = a
> StoreStoreBarrier r2 = *r1
> a = &x
>
> Can r1 == a && r2 == 0?
>
> (Where StoreStoreBarrier is no-op on machines not needing them.)
To avoid issues with segmentation faults, you might want to consider instead:
Initially, a == &y, x == 0, y == 2
Thread 1 Thread 2
x = 1 r1 = a
StoreStoreBarrier r2 = *r1
a = &x
Can r1 == &x && r2 == 0?
(Where StoreStoreBarrier is no-op on machines not needing them.)
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:41 EDT