← 💿 Disk Scheduling & I/O
Subtopic 3 of 4

8.3I/O transfer: polling, interrupts and DMA

The idea

I/O transfer methods: polling (CPU keeps checking), interrupts (device signals) and DMA (controller moves the whole block).

Think of it like this: Checking the oven every minute (polling), being told by a timer (interrupt), or having a helper carry the whole tray to the table and call you once (DMA).

Why it exists

The CPU is expensive; the less time it spends moving bytes, the more useful work it does.

How it works

  1. Polling: CPU busy-waits on the status register.
  2. Interrupt: one interrupt per word or byte, CPU moves the data.
  3. DMA: the CPU programs the controller (address, count) and carries on; one interrupt at the end.
  4. DMA steals memory cycles from the CPU: cycle stealing.

Worked example: A device sends 500 KB/s in 4-byte words, memory cycle 100 ns

128 000 words per second, each stealing one 100 ns cycle: 12.8 ms per second, about 1.3% of the bus time.

Now play with it

  • →Use the DMA calculator with a faster device.
  • →Read the table for when each method fits.
MethodCPU involvementBus useBest for
Programmed I/O (polling)CPU loops on the status registerCPU moves every wordtiny, fast devices where waiting is short
Interrupt-drivenone interrupt per word or byteCPU moves every wordslow character devices (keyboard)
DMAone interrupt per blockcontroller steals bus cyclesdisks and networks, large transfers
Words per second128000
Cycles stolen per second128000
Fraction of bus time0.013 (1.28%)

Cycle stealing: each word moved by DMA holds the memory bus for one cycle, so the CPU slows slightly.

Check yourself

In DMA, the CPU is interrupted

Remember: DMA: one interrupt per block, cycle stealing. Polling wastes CPU; interrupts cost per word.
Exam notes (the dense version)

Programmed I/O (polling): the CPU repeatedly checks the device status: simple but wastes CPU. Interrupt-driven I/O: the device signals when ready; the CPU does other work but takes an interrupt per byte or word. DMA: a controller moves a whole block between device and memory without the CPU, interrupting once at the end; it steals bus cycles (cycle stealing). Cycle-stealing percentage = DMA time ÷ total time. Use DMA for big, fast transfers and interrupts for slow character devices.

Previous year questions: Disk Scheduling & I/O (12)

PYQs are grouped by topic, so this is the full set for Disk Scheduling & I/O; try the ones that match this subtopic. Open all 12 on the topic page.