[concurrency-interest] volatile guarantee for directbuffer

Holger Peine Holger.Peine at fh-hannover.de
Wed Feb 15 03:48:45 EST 2012

Am 15.02.2012 09:26, schrieb Christian Vest Hansen:
> On Wed, Feb 15, 2012 at 07:59, Holger Peine <Holger.Peine at fh-hannover.de
> <mailto:Holger.Peine at fh-hannover.de>> wrote:
>     Am 14.02.2012 20:46, schrieb Boehm, Hans:
>     > - If only v is volatile, then x = 1; v = 1; z = 1 does not ensure
>     > that the write to x becomes visible before the write to z.
>     The JMM does ensure that the write to x becomes visible together with
>     the write to v, and that was the original poster's (Talip Ozturk)
>     question.
>     What happens to z is another question: The JMM only guarantees that it
>     will not become visible before the write to x or v (since it
>     happens-after the x and v writes).
> Does it? Why is it prevented from re-ordering the write to z up before
> the write to v, and indeed even before the write to x?

Because the three writes happen in the same thread, which establishes
a happens-before relation between them in the order of their appearance
in the source code ("program order").

Source of reference: "The Java Memory Model" by Pugh/Manson/Adve
POPL’05, January 12–14, 2005, Long Beach, California, USA.
as it says the following:
"Happens-before is the transitive closure of program order
and the synchronizes-with order", i.e. happens-before includes
program order.


Prof. Dr. Holger Peine
Hochschule Hannover, Fakultät IV, Abt. Informatik
Tel: +49(511)9296-1830  Fax: -1810 (shared, please state my name)
Ricklinger Stadtweg 120, D-30459 Hannover, Germany

More information about the Concurrency-interest mailing list