thepointman.dev_

Courses / Java Concurrency

Atomic & Lock-Free

advanced10 lessons

Compare-and-swap at the x86/ARM hardware level, AtomicInteger/Long/Reference, the compareAndSet loop pattern, the ABA problem and AtomicStampedReference as the fix, LongAdder's striped cells under high contention, VarHandle (Java 9) replacing Unsafe, and implementing a lock-free stack and queue from scratch.

// Lessons

  1. 01

    The Hardware Instruction — Compare-and-Swap at the CPU Level

    soon
  2. 02

    AtomicInteger and AtomicLong — The Java CAS Wrappers

    soon
  3. 03

    AtomicReference — CAS for Object References

    soon
  4. 04

    The compareAndSet() Loop Pattern — Lock-Free Counter from Scratch

    soon
  5. 05

    The ABA Problem — Why CAS Is Not Always Enough

    soon
  6. 06

    AtomicStampedReference and AtomicMarkableReference — ABA Countermeasures

    soon
  7. 07

    LongAdder and LongAccumulator — Striped Cells Under Contention

    soon
  8. 08

    VarHandle (Java 9) — The Unsafe Replacement

    soon
  9. 09

    Lock-Free Stack — A Real Implementation with CAS

    soon
  10. 10

    Lock-Free Queue — The Michael-Scott Queue Explained

    soon