[concurrency-interest] Suggestion: .hardGet() for atomic variables

Ruslan Cheremin cheremin at gmail.com
Thu Jan 19 16:04:07 EST 2012

I think, it depends on what you name "write". Failed CAS will be "like
write" in sense of cache coherence traffic -- at least AFAIK -- it
will request cache line to be in M state (read-for-update), so if
cache line was in some other core's cache -- it will be invalidated.
But failed CAS does not really update cache line value, so it seems
like writeback to main memory not needed. I do not know, does current
CPUs actually optimize this writeback.

2012/1/20 Raph Frank <raphfrk at gmail.com>:
> On Thu, Jan 19, 2012 at 8:48 PM, Ruslan Cheremin <cheremin at gmail.com> wrote:
>> current == value you've just read by .get() few lines ago.
> Ahh, right.
> For references, would .compareAndSet(null, null), also add in the syncing?
> Does a compare and set that fails to update count as a write, or just a read?
> _______________________________________________
> 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