9.3Interrupt-driven I/O
The idea
In interrupt-driven I/O the CPU carries on with other work, and the device interrupts it when ready.
Think of it like this: You do other chores and the oven beeps when the cake is done.
Why it exists
It lets the CPU overlap computation with I/O.
How it works
- CPU starts the I/O and returns to the program.
- Device raises an interrupt when ready.
- CPU saves state, runs the ISR (moves the word), restores state.
- Overhead is only the save/restore and the ISR.
Worked example: Compare
Polling wasted 5 cycles; interrupt-driven only spent 3 on save, ISR and restore.
Now play with it
- →Press Play: the CPU shows green "work" while the device is busy.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |
|---|---|---|---|---|---|---|---|---|---|---|
| CPU | work | work | work | work | work | save | ISR | rest | work | work |
| Device | busy | busy | busy | busy | busy | IRQ |
The CPU keeps computing while the device works. Overhead is only the context save/restore and the ISR itself.
Check yourself
When does the CPU normally recognise an interrupt?
Exam notes (the dense version)
Device raises INTR when ready; CPU saves context, jumps to ISR, returns (IRET). CPU does useful work meanwhile. Still moves each word through the CPU.
Previous year questions: I/O Interface, Interrupts & DMA (8)
PYQs are grouped by topic, so this is the full set for I/O Interface, Interrupts & DMA; try the ones that match this subtopic. Open all 8 on the topic page.