[concurrency-interest] AtomicXXX.lazySet and happens-before reasoning

Ruslan Cheremin cheremin at gmail.com
Tue Oct 4 15:00:03 EDT 2011


Oh, thank you Doug for your patience! Seems like now it is clear for me.

Now I can see the most confusing part for me was  about "preceeding stores
can't be reordered". Primary
I do not understand does term "reordering" here is about "instruction
reordering" only, or it is about instruction
effect _visibility_ reordering. I mean that stores can be issues in one
order, but I can see their effects in
different order due to some complex mechanics inside memory cache hierarchy.
Usually JMM uses term
reordering only in discussions and examples, not in formal definitions, so I
have no feeling of "default" meaning
for reordering in this context... May be it makes sense to clarify javadocs
about this?



On 09/30/11 11:18, Ruslan Cheremin wrote:
>
>> I still do not catch it. As far as I see we have 2 question about the
>> code:
>>
>
> These are still good questions, because they have no direct answers in JLS.
> But because they don't, you need to use other existing information to
> decode.
> One more try:
>
>
>> 1) Will lazySet write actually happens in some finite time?
>>
>
> The most you can say from the spec is that it will be written
> no later than at the point that the process must write anything
> else in the Synchronization Order, if such a point exists.
> However, independently of the spec, we know that so long as
> any process makes progress,  only a finite number of writes
> can be delayed. So, yes.
>
>  2) If it happens (== we see spin-wait loop finished) -- does it mean,
>>     what all writes preceeding lazySet are also done, commited, _and
>> visible_
>> to thread 2,
>>     which finished spin-wait loop?
>>
>
> Yes, although technically, you cannot show this by reference
> to the Synchronization Order in the current JLS. A fully
> integrated account would be along the lines of that for
> the (non-existent) order{Writes,Accesses} Fences in
> http://gee.cs.oswego.edu/dl/**jsr166/dist/docs/java/util/**
> concurrent/atomic/Fences.html<http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/atomic/Fences.html>
>
> -Doug
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20111004/9838ea68/attachment.html>


More information about the Concurrency-interest mailing list