methodson atomicInteger ?
dholmes at dltech.com.au
Tue May 31 23:48:55 EDT 2005
Yechiel Feffer writes:
> Yes, thanks David, this was my point,delegation of the increment op to the
> by the JVM, but I disagree with you that there is no real diff' between
> atomic incrementation. This is true for a single threaded env' but in a
> multi-threaded env' the cas retry loop may iterate several times,
rejecting the op'.
> This can be avoided by a delegated incrementation, and is not needed in
> since I dont want to know the result after.
Yes it is possible that a highly contended atomic variable could require
several CAS retries. Is it likely? I think not, though of course you could
construct a scenario that exercises this aspect.
If anyone were to encounter such an occurrence in practice then it would be
reasonable grounds for submitting an RFE to specialise those actions to
avoid the use of CAS. As I said the current scheme makes life a lot simpler
at both the Java and JVM level.
More information about the Concurrency-interest