JavaMemoryModel: Agreement to disagree: where things stand

From: Bill Pugh (
Date: Mon Jul 28 2003 - 01:26:36 EDT

OK, let me try to say where I think things stand on the core memory
model. I hope Sarita will excuse me for trying to put words in her
mouth. I haven't checked to see if the latest update of her model is
different from the model I looked at this morning.

Jeremy and I advocate using consistency and causality as the core JMM. I will
refer to this as CnC.

Sarita advocates a memory model that is strictly weaker than CnC. In other
words, it allows all behaviors allows by CnC, but also allows
additional behaviors that are illegal under CnC.

Both models meet certain high level requirements:
* programs that to not exhibit data races under SC execution only exhibit
   SC behavior
* In a block of code without synchronization or thread instructions, all
   of the standard unithread compiler transformations are allowed
* Values cannot materialize out of thin air. In particular, for:

        Initially, x = y = 0

        thread 1 thread 2
        r1 = x r2 = y
        y = r1 x = r2

   there is only one legal behavior (r1 == r2 == 0).

Jeremy and I think that Sarita's model is too weak. It allows
behaviors we find profoundly troubling. Even if we can't detail the
exact bad consequences of these troubling behaviors, we think
programers shouldn't have to reason about them or otherwise concern
themselves with them.

Sarita thinks CnC could be too strong. It might forbid some future
compiler or architecture optimization.

Jeremy and I think that CnC is not too strong. We are unconvinced
that any future compiler transformation should be allowed to violate
causality, and we haven't been able to come up with any compelling

Sarita thinks her model is not too weak. It allows strange behaviors
for programs with data races, but these strange behaviors do not
violate any
of the required properties we have enumerated.

At this point, we just have to say that Sarita, Jeremy and I have
agreed to disagree. We cannot resolve this issue among ourselves, and
we need input from the jsr133 expert group and the general JMM

JavaMemoryModel mailing list -

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