RE: JavaMemoryModel: Semantics musings

From: Bill Pugh (pugh@cs.umd.edu)
Date: Wed Sep 26 2001 - 08:05:42 EDT


At 12:01 PM +0100 9/26/01, Roly Perera wrote:
>Perhaps this is a silly question, but is it a foregone conclusion that
>all multi-threaded but unsynchronized Java programs are sequentially
>consistent? That seems to be implied by the above analysis.

No, No, No. I'm sorry you misunderstood me.

Let me try again:

Programs that are correctly synchronized execute under sequentially
consistent semantics. Programs with data races may exhibit
non-sequentially consistent behavior.

A pair of heap accesses to the same variable are conflicting if there
are performed by different threads and at least one of them is a
write.

A program is correctly synchronized if and only if, for all
sequentially consistent executions of the program, any pair of
conflicting accesses are ordered by a happens-before relationship.

---

This isn't a complete semantics, because is says nothing at all about programs that contain even a single data race. But this is one of the base elements that people can use to reason about whether a program is correctly synchronized.

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



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