• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

If the CPU polls devices (checks repeatedly if they’re done), it wastes cycles when devices are slow. The CPU should be free to do other work while waiting for I/O, and only handle the device when it’s actually ready.

Core Idea

A special function that executes when a device raises an interrupt, allowing the CPU to respond asynchronously to I/O completion without busy-waiting.

How It Works

  1. Device completes operation and raises an interrupt signal on the control bus
  2. CPU pauses current work, saves context (registers, program counter)
  3. CPU jumps to the interrupt handler (addressed by interrupt vector)
  4. Handler reads device status register to confirm completion
  5. Handler copies data from device buffer to memory (or vice versa)
  6. Handler wakes up any process waiting for this I/O
  7. CPU restores context and resumes previous work
interrupt CPU CPU executing process Handler Interrupt Handler (ISR) CPU->Handler context switch to ISR Device Device completes I/O Device->CPU interrupt signal Handler->CPU return from interrupt Process Waiting Process woken up Handler->Process wake_up()

Key Properties

  • Runs in kernel mode with high priority
  • Must execute quickly (other interrupts may be masked)
  • Can’t block or sleep (would hang the system)
  • Shares data with the interrupted process via kernel structures

Connections

Edge Cases & Gotchas

  • Interrupt handlers can’t allocate memory or sleep (leads to deadlock)
  • Nested interrupts require careful stack management
  • Lost interrupts (device interrupts before handler is registered) cause hangs
  • Interrupt storms (too many rapid interrupts) can freeze the system