RE: JavaMemoryModel: The Intuition Is the Model - the full model is in this email!

From: Sarita Adve (sadve@cs.uiuc.edu)
Date: Tue Jul 29 2003 - 18:18:29 EDT


I am actually finessing this right now, so stay tuned. (I am actually not
sure how CnC handles some behavior from write-write data races either, and
have a message pending with B/J.)

Thanks,

Sarita

> -----Original Message-----
> From: lvictor@sunlabs-sr1.East.Sun.COM
> [mailto:lvictor@sunlabs-sr1.East.Sun.COM] On Behalf Of
> victor.luchangco@sun.com
> Sent: Tuesday, July 29, 2003 5:10 PM
> To: sadve@cs.uiuc.edu
> Cc: javamemorymodel@cs.umd.edu
> Subject: Re: JavaMemoryModel: The Intuition Is the Model -
> the full model is in this email!
>
>
>
> More on competing writes:
>
> > > Initially, X == 0
> > >
> > > Thread 1 Thread 2
> > >
> > > X = 1 X = 2
> > > X = 3 r2 = X
> > > r1 = X
> > >
> > > What values may each of r1 and r2 get? Or more to the
> point, what
> > > "special write" replaces "X = 2" so that we cannot get r1 == 1?
> >
> > I don't think there will be an argument that this should
> happen. So the fix:
> > a race write obliterates any values previously deposited by
> its own thread.
> > (Since we have SC semantics, "previous" is well-defined.)
>
> This fix doesn't quite work. Consider, for example, the following:
>
> Initially, X == 0, V == 0 (V is volatile)
>
> Thread 1 Thread 2 Thread 3
>
> X = 1 X = 2 while (V == 0) {}
> V = 1 r2 = X X = 3
> r1 = X
>
> Can we get r1 == 1?
>
> Perhaps we should say that a write obliterates any value written by a
> write that happens before it (i.e., use "previous" in the "happens
> before" sense, rather than using program order or the SC execution).
>
> I'm still not quite sure how to define this notion though, because
> both "r1 = X" and "r2 = X" may see the "X = 2" write, and somehow,
> we need to know that r1 cannot get 1 while r2 can. The notion we
> are looking for may be close to what WW-dag consistency allows
> (i.e., the "allowable writes" definition of Jeremy and Bill).
>
>
> > Of course, in the philosophy of "weaker is better," I can think of
> > one scenario (albeit far-fetched) where [another "strange"
> execution]
> > may actually occur, and it is unclear to me if we do want to fix it.
>
> I don't know whether we should or shouldn't allow these executions.
> Even when I have an opinion on the matter, I haven't thought hard
> enough, nor consulted widely enough, to be confident that I have
> considered all the issues. I'm even ambivalent about the "weaker
> is better" philosophy (though I don't believe that we should make
> the model stronger just to make debugging broken programs easier--
> there are better ways to do that). That's one of the reasons I'm
> glad Jeremy and Bill have looked so long and hard at these issues.
> Someone ought to.
>
> Anyway, let me know if you come up with something that resolves
> the above problem, or if you think the idea of using "allowable
> writes" is sufficient (assuming the details can be worked out).
>
> Victor
>

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



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