← Kernel InternalsKERNEL INTERNALS 4.3

Kernel Synchronization

Not started yet — spinlocks vs. mutexes in kernel context, and the one question every kernel interview asks: can this code sleep? 8 bytes.

What this topic will cover

  • Why the kernel needs locks at all — SMP, preemption, and interrupts all touching shared data.
  • The spinlock API and its one hard rule: never sleep while holding one.
  • spin_lock_irqsave and the ISR-deadlock scenario it exists to prevent.
  • Kernel mutexes, which can sleep — process context only.
  • The spinlock-vs-mutex decision: can this context sleep, and how long is the critical section.
  • atomic_t for lock-free counters, completions, and a name-drop-level pass on RCU.

Not yet catalogued — check back once this topic is underway.

Notes from readers

Comments — via GitHub