Tagged articles
3 articles
Page 1 of 1
Xuanwu Backend Tech Stack
Xuanwu Backend Tech Stack
Jan 21, 2025 · Fundamentals

Understanding CAS: Solving the ABA Problem and Other Pitfalls in Java Concurrency

This article explains the classic ABA issue in Java's Compare‑And‑Swap (CAS) operations, outlines why long spin loops and single‑variable limitations can degrade performance, and presents practical solutions such as AtomicStampedReference, LockSupport, ReentrantLock, and optimized data structures to mitigate these challenges.

ABA problemCASJava concurrency
0 likes · 4 min read
Understanding CAS: Solving the ABA Problem and Other Pitfalls in Java Concurrency
Xiao Lou's Tech Notes
Xiao Lou's Tech Notes
May 13, 2020 · Backend Development

How AtomicStampedReference Solves the ABA Problem in Java Concurrency

This article explains the ABA issue inherent in Java's CAS operations, demonstrates it with AtomicInteger examples, and shows how AtomicStampedReference (and AtomicMarkableReference) use version stamps to prevent erroneous multiple updates in multithreaded environments.

ABA problemCASatomicstampedreference
0 likes · 8 min read
How AtomicStampedReference Solves the ABA Problem in Java Concurrency