Re: JavaMemoryModel: prescient write question

From: Bill Pugh (pugh@cs.umd.edu)
Date: Wed Jul 03 2002 - 12:57:38 EDT


At 9:56 AM -0600 7/2/02, Yue Yang wrote:
>Bill,
>
>Does your semantics allow r1 = 1 in the following cases?
>
>* Case 1:
>
>Thread 1 Thread 2
>
>r1 = x; r2 = y;
>y = 1; x = r2;
>
>
>* Case 2:
>
>Thread 1 Thread 2
>
>r1 = x; r2 = x;
>x = 1; x = r2;
>
>
>It's not clear if x = r2 would use the same GUID as x = 1 or if it would
>use a different GUID since assignment with local varialbes is not
>explicitly discussed in your semantics.
>
>Thanks!
>
>-- Jason
>

I really want to encourage anyone with questions to download the
simulator and try it.

Both cases allow the same behaviors: r1 == r2 = 0, r1 == 0 and r2 ==
1, or r1 == r2 == 1.

  [savoir 23] JavaSim < yy1.jmm
Execution:
         Thread 0
                 "r1" = IntVal 0
         Thread 1
                 "r2" = IntVal 0
Execution:
         Thread 0
                 "r1" = IntVal 0
         Thread 1
                 "r2" = IntVal 1
Execution:
         Thread 0
                 "r1" = IntVal 1
         Thread 1
                 "r2" = IntVal 1
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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