Re: JavaMemoryModel: New Causality Test

From: Hans Boehm (Hans_Boehm@hp.com)
Date: Tue Feb 10 2004 - 22:27:54 EST


Jerry -

This program is race free by our definition. I don't see how this
behavior could be allowed.

Hans

On Tue, 10 Feb 2004, Jerry Schwarz wrote:

>
> In thinking about "out of thin air" I realized that all the causality tests
> are straight line code. What about loops?
>
> Consider
> ------------------------
>
> Initially: x=0
>
> Thread 1:
> while(true) ; // loop
> x = 1;
>
> Thread 2:
> r = x;
>
>
> Behavior in question: r=1
>
> Argument for not allowed:
> The assignment to x doesn't occur in any execution in program order so r=1
> is out of thin air.
>
> Argument for allowed:
> In reality the condition in the loop would be some complicated code and the
> compiler might not be able to determine whether the loop terminates.
> However it still might recognize that x isn't referenced in the loop and
> move the assignment to it ahead of the loop.
>
> ------------------------------
>
> Personally I think this should be allowed because I think the compiler
> optimization is reasonable and forbidding it would probably require
> revision of standard optimization technologies. But I don't think it's
> allowed by either MP or SC-.
>
>
>
>
>
>
>
>
> -------------------------------
> JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
>

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



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