Practical DSA
Locks and Atomics
Learn how mutexes and atomics prevent race conditions, and why hardware contention can make multithreaded code slower than single-threaded code.
Practical DSA
Cache Coherency and False Sharing
Explore the performance cost of synchronization, how to mitigate it, and how to avoid it entirely with better algorithm design.
Practical DSA
Data Tearing and std::atomic
Understand the physical reality of moving data between RAM and registers. Learn why explicit loads and stores are required to prevent data tearing in complex structs.
Practical DSA
Compare-And-Swap (CAS)
Learn how to perform complex lock-free atomic updates using compare_exchange_weak() and the hardware limitations.
Practical DSA
Instruction Reordering
Learn how CPU out-of-order execution breaks lock-free code, and how to use seq_cst, acquire, release, acq_rel, and relaxed to fix it.
Practical DSA
Lock-Free Pointers
Discover why using CAS on pointers is a hardware minefield, exposing the physical realities of memory allocators and the infamous ABA problem.
Practical DSA
Queues and Stacks
Learn how to decouple producers and consumers using FIFO and LIFO buffering structures.
Practical DSA
Ring Buffers
Learn how to bend a contiguous array into an infinite circle to build fast FIFO data pipelines.
Practical DSA
SPSC Lock-Free Queues
Build a Single-Producer Single-Consumer lock-free ring buffer using atomics, memory barriers, and cache-line alignment.
Practical DSA
Intrusive Linked Lists
Eliminate node wrappers and heap allocations entirely. Learn how the Linux kernel uses intrusive structures to weave physical memory into multiple logical lists simultaneously.
Practical DSA
Skip Lists and Probabilistic Linking
Trade memory capacity for faster search speeds. Learn how probabilistic express lanes create highly concurrent, self-balancing data structures.