All posts

threading

5 posts
THREADING

Spinlocks, Mutexes, and Futexes: Picking the Right Lock

Three primitives cover almost every locking decision: spinlocks, mutexes, and futexes. They solve the same problem with very different cost models — burning CPU vs trapping to the kernel vs the hybrid approach modern mutexes actually use.

SYSTEMS

Memory Barriers Demystified: Acquire, Release, and Why They Matter

Compilers reorder. CPUs reorder. Single-threaded code never notices — multi-threaded code crashes mysteriously. A clear walk through acquire and release semantics, what the hardware actually does, and the spinlock that ties it all together.