Re: JavaMemoryModel: Most (all?) JVM's incorrectly handle volatile reads-after-writes

From: Doug Lea (dl@altair.cs.oswego.edu)
Date: Mon Nov 29 1999 - 19:31:07 EST


> A bound on infinitely stale reads and infinitely unflushed writes
> would not be too hard to define into the semantics without the need
> for any syntax changes. The simplest example of the problem comes up
> with the following example:
>
> initially, quit = false
>
> Thread 1: Thread 2:
> quit = true; while (!quit) do_something();
> exit();
>
> Under all of the current proposed semantics, thread 2 might loop
> forever.

I think I'd rather guarantee that thread 2 will be optimized into an
infinite loop (regardless of the nature of "do_something"), or at
least have the compiler warn about this possibility.

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



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