[concurrency-interest] volatile guarantee for directbuffer

Holger Peine Holger.Peine at fh-hannover.de
Wed Feb 15 04:29:53 EST 2012


Am 15.02.2012 10:18, schrieb David Holmes:
> Holger Peine writes:
>> 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").
> 
> Not quite. Christian is correct. The thread that does the writes must not be able to detect them out of order but other threads can. 

OK - apparently my understanding of the JMM is incorrect at this point
(at least). David, I hope that my first statement above ("The JMM does
ensure that the write to x becomes visible together with the write to
v") is correct nevertheless?

Concerned,
Holger.

-- 
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