Conceptual
Login

Splitting an Interrupt into Two Halves

Real work often cannot be done in an interrupt handler, because it needs to sleep, allocate, or take a mutex. The threaded form splits the response in two: a tiny piece running in atomic context that decides whether the interrupt was yours and quietens the device, and a second function run by a kernel thread afterwards, where sleeping is fine. In Rust both halves are methods on the same handler type, so the state they share is already owned and locked correctly. Doing everything in the atomic half is how a driver adds latency to the whole machine or freezes it outright.

Questions this Concept answers

  • Why is the threaded form the answer when responding to an interrupt requires allocating memory or taking a mutex?