Counters Under Contention in Java
Counting looks trivial until many threads hit the same number.
Counting looks trivial until many threads hit the same number.
Atomic counters are simple and effective.
The ABA problem is one of the classic edge cases in non-blocking algorithms.
Compare-and-set is the core move behind most atomic programming in Java.
These four atomic types cover a large percentage of practical application-level atomic use cases.