Locking

Kernel code can run concurrently on multiple CPUs and in different execution contexts. Locking primitives coordinate access to shared state. The appropriate primitive depends on the context, whether waiting may sleep, and the guarantees the protected operation requires.

Start with Lock types and their rules, which explains sleeping, spinning, and CPU-local locks, their nesting rules, and how their behaviour changes under PREEMPT_RT.

Locking primitives #

Execution context and userspace coordination #

Locking and preemption describes protection for per-CPU data, processor state, and critical sections.

The futex articles cover priority inheritance, requeueing, robust futexes, and the robust futex ABI.

Validation and diagnostics #

Edit this page