Treiber stack
A lock-free stack using CAS to implement push and pop operations without locks, named after R. Kent Treiber.
The Treiber stack is a foundational lock-free data structure from the early 1980s. It uses atomic compare-and-swap instructions to allow multiple threads to push and pop elements concurrently without mutexes. Each push or pop operation atomically updates the stack head; if another thread modified it between the read and update (collision), the operation retries.
The Treiber stack is a building block for lock-free systems and demonstrates how CAS enables lock-free parallelism. It is, however, vulnerable to the ABA problem on certain CPU architectures without extended CAS variants.