Systems Programming · Cluster

Concurrency Primitives

Atomics, fences, and lock-free design.

  1. 01 Atomicity and Ordering Are Separate Guarantees in the C Memory Model Why making a shared object atomic removes lost updates but not stale reads, how the C memory model defines a data race, and what happens-before does and does not cover. foundational · Apr 26, 2024
  2. 02 Compare-and-Swap and Why the Retry Loop Must Re-read How a conditional store becomes a universal synchronisation primitive, why weak compare-and-exchange may fail spuriously, and what makes a CAS loop terminate. foundational · May 16, 2026
  3. 03 Acquire and Release: What Each Ordering Forbids The precise prohibitions that acquire and release each impose, why the pair cannot order a store against a later load, and when a standalone fence is the only option. foundational · Apr 26, 2024
  4. 04 Cache Line Transfer, False Sharing, and the Cost of Contention Why an atomic operation on an uncontended location is cheap and on a contended one is not, what coherence protocol traffic each attempt generates, and how padding and sharding change the shape of the cost. intermediate · Jan 30, 2023
  5. 05 Spinlock Design from Test-and-Set to Ticket Locks How a test-and-set lock starves its waiters, why test-and-test-and-set helps, and how a ticket lock turns a race into a queue without a fairness guarantee. intermediate · Dec 30, 2022
  6. 06 Seqlocks: Consistent Reads Without Reader-Side Writes How an even/odd sequence counter lets readers detect a concurrent update, why the read side must be free of side effects, and what the retry cost looks like under write-heavy load. intermediate · May 1, 2024
  7. 07 The ABA Problem in Treiber Stacks Why a single compare-and-swap suffices to push onto a Treiber stack but not to pop from it, what the address comparison cannot detect, and which remedies actually close the window. intermediate · Jul 14, 2025
  8. 08 Memory Reclamation for Lock-Free Structures Hazard pointers, epoch-based reclamation, and reference counting compared by what they cost on the read path, when memory is actually returned, and which failure they tolerate. advanced · Jul 24, 2025
  9. 09 Progress Guarantees and the Lock-Free Hierarchy The difference between obstruction-free, lock-free, and wait-free, why lock-free does not mean no locks, and how helping makes a single-word operation wait-free. advanced · Sep 2, 2025
  10. 10 Litmus Tests and Store Buffering How a five-line litmus test distinguishes total store order from sequential consistency, why the x86 store buffer permits a forbidden outcome, and what each outcome costs to rule out. advanced · Jul 21, 2023