[concurrency-interest] Single writer multiple readers no barriers -- safe ?

Vitaly Davidovich vitalyd at gmail.com
Wed Jun 4 16:00:56 EDT 2014

If you had multiple writers publishing a reference, lazySet won't work -
you'd need a CAS loop (or locking, depending on expected
contention/conflict rate).

Sent from my phone
On Jun 4, 2014 3:13 PM, "vikas" <vikas.vksingh at gmail.com> wrote:

> >>On Fri, Nov 29, 2013 at 6:51 AM, Nitsan Wakart <[hidden email]> wrote:
> >>From my experience, lazySet is indeed your best choice (but only a valid
> choice for a single writer). You >>need a volatile read to match the HB
> relationship otherwise the compiler is free to optimize the value you
> >>read, so someone using your map in a loop may end up stuck if you don't
> do
> it.
> Hi Nitsan,
>    Why you said lazySet is a valid choice for single writer. Can you give
> any reference or example on what can go wrong with multiple writers.
> >> You hopefully meant StoreStore | LoadStore .  Otherwise we have a very
> >> subtle but serious problem.  >>(See
> >> *http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/no_write_fences.html
> >> *for a C++ discussion >>from a few years ago.)
> Hi Hans,
>   The link you provided is no more valid. Can you please provide the fresh
> link
> thanks
> vikas
> --
> View this message in context:
> http://jsr166-concurrency.10961.n7.nabble.com/Single-writer-multiple-readers-no-barriers-safe-tp10306p11048.html
> Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140604/82054594/attachment.html>

More information about the Concurrency-interest mailing list