RE: JavaMemoryModel: No "Spooky errors at a distance"

From: Jerry Schwarz (jschwarz@us.oracle.com)
Date: Fri Mar 08 2002 - 13:08:40 EST


At 09:30 PM 3/7/2002, David Holmes wrote:
>Jerry Schwarz wrote:
> > But we could require that the thread pool or Executor do something before
> > starting each task. Thus it is not necessary that feature 2 be
> > unconditional. An alternative feature 2': if task r3 loads two different
> > references to x, the first incorrectly synchronized and the second
> > correctly synchronized and does [fill in the blank] between the first and
> > the second, then ...
>
>I don't understand what point you are trying to make here. If the thread
>pool or executor does "something" before starting each task then that is
>part of the application logic and doesn't, as fas as I can see, impact on
>the original question that Bill asked. Given the scenario Bill outlined,
>with a thread having one invalid reference and one valid one, then I agree
>that the all accesses through the valid reference should be valid. I also
>expect that all accesses through the invalid one will become valid due to
>the synchronization involved with obtaining the valid one - but that's not
>something I would expect to be guaranteed by the model, nor would I rely
>upon it.

I anticipated Bill's subsequent message containing an example of a compiler
optimization that feature 2 would prohibit. (That is, I didn't know exactly
what the example would be, but I anticipated there would be one). Now the
difference between feature 2 and feature 2' become clear. In Bill's
example if we accept feature 2 then the optimization would be disallowed.
If we accept feature 2' then the example doesn't contain [fill in the
blank] so feature 2' doesn't apply and we can say (as I anticipate Cliff
will say) that any behavior is acceptable for code containing
unsynchronized references.

>David Holmes
>
>-------------------------------
>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:38 EDT