CSS Optional — Paper-II, Section-A · P-II.III.VIII
| Polling | Interrupts | |
|---|---|---|
| Who initiates | CPU repeatedly checks (busy-waits on) the device status register | Device signals the CPU only when ready/done |
| CPU usage while waiting | Wasted — CPU can't do other work | CPU free to run other processes until interrupted |
| Best for | Extremely high-frequency, low-latency I/O where interrupt overhead itself would dominate | General-purpose, efficient CPU utilization — the default in modern OSes |
When the device raises an interrupt, the CPU suspends its current work and jumps to an Interrupt Service Routine (ISR) to handle it, then resumes.
For bulk transfers (disk, network), routing every byte through the CPU is wasteful. A DMA controller transfers data directly between the device and main memory, and interrupts the CPU only once — when the entire transfer is complete — freeing the CPU almost entirely from the transfer.
A buffer temporarily holds data being transferred between a device and a process, letting computation and I/O overlap instead of running strictly sequentially.
Simultaneous Peripheral Operations On-Line — output (e.g. print jobs) is queued to disk first and a background process feeds it to the (slow) device at its own pace, so the requesting application doesn't block waiting for the physically slow device.
Since seek time dominates disk performance, the OS orders pending requests to minimize head movement.
| Algorithm | Rule | Note |
|---|---|---|
| FCFS | Service requests in arrival order | Fair but can cause large, inefficient head swings |
| SSTF (Shortest Seek Time First) | Service the closest request to current head position | Can starve requests far from the current "hot zone" |
| SCAN | Head sweeps in one direction servicing requests, reverses at the end | "Elevator algorithm" — like SSTF's fairness fixed |
| C-SCAN (Circular SCAN) | Head sweeps one direction servicing requests to the end, then jumps back to the start WITHOUT servicing on the return, then sweeps again | More uniform wait time than plain SCAN (no bias toward the middle of the disk) |
| LOOK / C-LOOK | Like SCAN/C-SCAN but the head only goes as far as the last request in that direction, not the physical end of the disk | Saves the wasted travel to the disk's physical edge when there's nothing to service there |
A device is controlled through a device controller (the electronics that operate a specific device type), which the CPU communicates with via a small set of device registers: a status register (readable — is the device busy/ready/error?), a control register (writable — tell the device what to do), and data-in/data-out registers (transfer the actual data one unit at a time). The OS's device driver is the software layer that knows how to speak a specific controller's register protocol, presenting a uniform interface upward to the rest of the kernel.