[concurrency-interest] Extended access methods for Atomics (and AQS)
davidcholmes at aapt.net.au
Thu Apr 15 20:01:19 EDT 2010
> 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
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.
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
More information about the Concurrency-interest