FIT2100 Chap.3 I/O Devices and DMA
I/O Devices and DMA
Input and output hardware varies by transfer unit, addressing and timing. Block devices move addressable blocks, while character devices expose streams. Controllers translate between those device behaviours and the system bus. Drivers use control, status and data registers to issue operations and interpret results.
Programmed I/O keeps the processor involved in status checking and copying.
Interrupt-driven I/O lets other work run until an event needs attention. Direct memory access delegates a programmed block transfer to a controller and usually uses an interrupt to report completion. Disk scheduling adds another policy question: how should pending cylinder requests be ordered to balance movement and fairness?
What this chapter covers
- 01
Block and character devices
- 02
Controller registers
- 03
Memory-mapped input and output
- 04
Polling
- 05
Interrupt-driven transfers
- 06
Direct memory access
- 07
Device drivers
- 08
Disk seek scheduling
Worked example · free
Compare disk service orders
- +2FCFS order is 40 to 12 to 48 to 83 to 35. Movement is 28 + 36 + 35 + 48 = 147 cylinders.
- +2Shortest-seek-first order is 40 to 35 to 48 to 12 to 83. Movement is 5 + 13 + 36 + 71 = 125 cylinders.
- +2The second policy saves 22 cylinders for this queue, but distant requests can wait longer and may starve under continuing arrivals.
Key terms
- Block Device
- A device that transfers addressable fixed-size blocks and supports block-oriented access.
- Character Device
- A device that presents a stream of characters or bytes without a seekable block model.
- Device Driver
- Operating-system code that translates generic I/O requests into controller-specific commands and handles completion or error events.
- Programmed I/O
- A transfer style in which processor instructions repeatedly inspect device status and move data.
- Direct Memory Access
- Controller-driven block movement between a device and memory after processor setup.
- Seek Time
- The time required to move a disk head to the target cylinder.
I/O Devices and DMA FAQ
Does direct memory access eliminate interrupts?
No. The controller can move a bulk block without processor instructions for every byte, but completion or failure is commonly reported through an interrupt. The CPU still configures the transfer and handles the resulting event.
When can polling be reasonable?
Polling can be acceptable when readiness is expected almost immediately, the check is cheap or the system has no useful work to overlap. Long or unpredictable waits make repeated status checks wasteful compared with interrupt-driven completion.
Why are device drivers needed?
Controllers expose device-specific registers and protocols. Drivers encapsulate those details behind operating-system interfaces, manage errors and connect hardware events to waiting requests. This supports portability while retaining controlled hardware access.
Why is shortest seek not always the fairest policy?
Selecting the nearest pending cylinder minimises each local movement but can repeatedly bypass a distant request when new nearby work arrives. Lower average movement and bounded waiting are different goals, so a complete recommendation names both.
Assessment move
Build a comparison table for programmed I/O, interrupt-driven I/O and DMA using processor involvement, hardware requirement, transfer size and overhead. Draw one completion path from driver setup to interrupt. For disk practice, write every visited cylinder and movement term, then state the fairness trade-off.
In a demonstration, explain controller state and return values rather than claiming that the device acts magically behind the operating system. Revise transfers by counting CPU actions rather than relying on labels. For a fixed block, list who copies each unit, how readiness is detected, when the requester blocks and how completion becomes visible.
Change the block size and availability of other ready work, then reassess whether polling, interrupt-driven copying or DMA is justified. Add setup, bus contention and handler costs so “DMA is fastest” never becomes an unsupported universal rule. For a controller trace, mark command-register writes, status checks, memory ownership and the point at which a buffer may safely be reused.
For disk scheduling, generate a new queue, keep arrival order separate from cylinder order and state a deterministic tie rule before calculating. Audit every absolute movement term and check that the count of serviced requests matches the queue. Compare total movement with fairness or starvation exposure rather than treating the smallest number as a complete policy evaluation.
In demonstrations, show the state before setup, while the request is outstanding and after completion or error. Explain which observation belongs to hardware status, which belongs to driver bookkeeping and which belongs to process state. This makes the evidence useful even when timing differs between runs.
Working through I/O Devices and DMA in FIT2100? Sia is AskSia’s AI Computer Science tutor — ask any FIT2100 I/O Devices and DMA question and get a clear, step-by-step explanation grounded in how FIT2100 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.