RE: JavaMemoryModel: Why CnC

From: David Holmes (
Date: Wed Jul 30 2003 - 02:57:58 EDT

Sarita Adve wrote:
> I am no expert on this issue and am not going to push this aspect if
> there's resistance, but I really am curious if people on this list
> with this sentiment.

I'm afraid that I, for one, am losing track of what the issues are

As a programmer, and a teacher of programmers, I'm most concerned
about document A (as Doug listed). I want to know the high-level
semantics for getting correctly synchronized MT programs using
combinations of synchronized blocks, final and volatile references and
atomic operations.

As far as I am aware both models support the same high-level semantics
for correctly synchronized programs.

Any program that allows concurrent access to a shared variable without
using one of the aforementioned mechanisms is, in my view, an
incorrect "broken" program. Now whether a particular "broken" program
produces an incorrect result depends on the nature of the program, and
it may be that the safety rules of the JMM will keep the program
within some region where it still acts "correctly" - but bouncing on
the safety net doesn't negate the fact that you fell off the trapeze.

As far as I am concerned the allowed behaviour in unsynchronized
programs is not of great importance - except that the various safety
requirements must be met.

To that end I view all of this low-level model stuff as a means for
expressing how correct synchronization is achieved, and how those
safety guarantees are achieved in incorrectly synchronized programs.
If one model makes it easier to establish this then I'd go for that

>From a VM implementor's perspective I want an easy way to verify that
my latest super-duper optimisation for benchmark XYZ is legal under
the JMM. If one model makes it easier to verify that then I'd probably
prefer that model. On the other hand if my optimisation is not legal
under one model, but is under the other, then I'd probably go for that
one naturally :)

I agree with Bill's latest email that causality just seems "right".
Non-causal systems just make my head spin.

David Holmes

JavaMemoryModel mailing list -

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