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

From: Bill Pugh (pugh@cs.umd.edu)
Date: Sun Nov 21 1999 - 08:32:57 EST


At 7:18 PM -0500 11/20/99, Bill Pugh wrote:
>Below is a test program. ExactVM, HotSpot, Microsoft's vm, and IBM's
>WinTel JVM all fail on multiprocessor systems.
>

I forgot to include any same output. Here some is:

Thread 1
After writing 7820 to a, read 61 from b
After writing 7826 to a, read 72 from b
After writing 7836 to a, read 79 from b
After writing 7842 to a, read 85 from b
* After writing 7848 to a, read 91 from b
After writing 7861 to a, read 105 from b
After writing 7867 to a, read 111 from b
After writing 7884 to a, read 124 from b
Thread 2
After writing 72 to b, read 7816 from a
After writing 78 to b, read 7821 from a
After writing 84 to b, read 7827 from a
After writing 90 to b, read 7836 from a
* After writing 104 to b, read 7843 from a
After writing 110 to b, read 7848 from a
After writing 124 to b, read 7862 from a
After writing 128 to b, read 7868 from a

Note that each thread is writing an increasing series of values to
its variable.

So thread 1, after writing 7848 to a, reads 91 from b.
That must have occurred before thread 2 wrote 104 to b,
which occurred before thread 2 read 7843 from a, which must have
occurred before thread 1 wrote 7848 -- contradiction.

-------------------------------
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