[concurrency-interest] Extended access methods for Atomics (and AQS)

David Holmes davidcholmes at aapt.net.au
Thu Apr 15 20:01:19 EDT 2010


Doug writes:
> On 04/14/10 10:55, Bryan Thompson wrote:
> > What about eventually consistent increment() and add() methods
> > which do not rely on CAS operations and are thus not subject to
> > spins under concurrent requests?
> We do define the AtomicInteger increment and add operations so
> they can be intrinsified on platforms supporting atomic arithmetic
> read-modify-write.

No we define them using CAS at the Java level. I think this is necessary to
ensure we can return previous values "correctly". For example we might use a
lock:add on x86 to do an atomic addition, but we don't have a way to
atomically capture the previous value.


I don't think any JVMs do so; probably
> because these aren't usually faster, or enough faster, on most
> platforms than CAS versions to bother.
> -Doug
> _______________________________________________
> 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