Re: JavaMemoryModel: What's "control dependence" mean?

From: Bill Pugh (pugh@cs.umd.edu)
Date: Wed Sep 12 2001 - 18:12:46 EDT


At 4:51 PM -0400 9/12/01, Jan-Willem Maessen wrote:
> > Example 1
>>
>> Initially, x = y = 0
>>
>> Thread 1:
>> r1 = x
>> if r1 >= 0
>> y = 1
>>
>> Thread 2:
>> r2 = y
>> x = r2
>>
>> Question: is it legal for this program to result in r1 = r2 = 1?
>
>Answer: no. As written, the assignment to y fails condition (2). We
>must execute r1 = x first in thread 1.

>2) A writes may be reordered across a control flow boundary iff it can
> be shown that the particular write will occur in any execution.

Why "no"? It is impossible in this program for x to contain a
negative value. So the assignment (2) always occurs in any execution.

Bill
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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