[concurrency-interest] Volatile stores in constructors, disallowed to see the default value

David Holmes davidcholmes at aapt.net.au
Thu Nov 28 17:26:45 EST 2013


Zhong Yu writes:
> On Thu, Nov 28, 2013 at 4:07 AM, David Holmes
> <davidcholmes at aapt.net.au> wrote:
> >> -----Original Message-----
> >> From: concurrency-interest-bounces at cs.oswego.edu
> >> [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Aleksey
> >> Shipilev
> >> Sent: Thursday, 28 November 2013 4:28 PM
> >> To: dholmes at ieee.org; concurrency-interest
> >> Subject: Re: [concurrency-interest] Volatile stores in constructors,
> >> disallowed to see the default value
> >>
> >>
> >> On 11/28/2013 02:46 AM, David Holmes wrote:
> >> >> In order to answer what outcomes are possible we need to dump the
> >> >> usual/partial/misleading "reorderings" and "happens-before"
> >> mindset, and
> >> >> get to the ground of spec. That is, we need to construct
> the possible
> >> >> traces and see if those traces are committable, as per JLS 17.4.8.
> >> >
> >> > And therein lies your mistake. The "happens-before mindset" as
> >> you put it is
> >> > what determines what the legal executions are. It was obvious from
> >> > happens-before considerations that your premise was invalid.
> >>
> >> Happens-before alone is not enough to mandate the semantics of Java
> >> Memory Model. Even though it can cover the significant part of the
> >> behaviors, the complete behavior of the model is governed by
> >> well-formedness of executions, as per JLS 17.4.{6-8}. The classic
> >> example (even shown in spec!) when the happens-before
> consistent program
> >> produces causality violations.
> >
> > All that shows is that the presence of happens-before is not
> sufficient to
> > guarantee an allowed ordering. But you were arguing for an
> enforced ordering
> > when happens-before was absent. So I would maintain that the absence of
> > happens-before showed that the given reordering was permissible.
>
> We know that, data race free => sequential consistency. You seem to
> imply that the converse theorem is also true (barring some cases). It
> sounds quite plausible, but is there a proof?

No I wasn't saying anything about DRF or SC. Simply saying that if there is
no happens-before relation that forces A->B, then B->A is quite permissible.

David
-----


> >
> >> > Q.E.D
> >>
> >> So, there was nothing "obvious" unless you have the concrete proof. The
> >> only reasonable way to prove this particular thing *was* to show the
> >> committable traces leading to particular results (like I did), *and* to
> >> find flaws in the reasoning in larger JMM. "La-la-la, happens-before,
> >> la-la-la" is hardly a proof, even though the conclusion is the same in
> >> this particular case. Make no mistake about it.
> >
> > Well obviously we should just remove happens-before from the
> spec as it is
> > obviously completely superfluous to any kind of reasoning about the JMM.
> >
> > David
> >
> >
> >> -Aleksey
> >> _______________________________________________
> >> Concurrency-interest mailing list
> >> Concurrency-interest at cs.oswego.edu
> >> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> >>
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > Concurrency-interest at cs.oswego.edu
> > http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>



More information about the Concurrency-interest mailing list