I/O Management in OS — DMA, Device Drivers, Scheduling | Tutorials Logic
I/O Hardware
I/O devices communicate with the CPU through:
- Ports: Connection points for I/O devices (USB, serial, parallel)
- Buses: Shared communication pathways (PCI, USB, SATA, PCIe)
- Device Controllers: Hardware components that manage specific devices. They have registers (data, status, control) that the CPU reads/writes.
I/O Techniques
| Technique | Description | CPU Usage | Use Case |
|---|---|---|---|
| Programmed I/O (Polling) | CPU continuously checks device status (busy-waiting). CPU is fully occupied during I/O. | 100% (wasteful) | Simple embedded systems |
| Interrupt-Driven I/O | CPU initiates I/O and continues other work. Device interrupts CPU when done. | Low (during I/O) | Most modern systems |
| DMA (Direct Memory Access) | DMA controller transfers data directly between device and memory without CPU involvement. CPU only involved at start and end. | Very Low | High-speed devices (disk, network) |
Device Drivers
A device driver is software that provides a standard interface between the OS and a specific hardware device. It translates generic OS I/O requests into device-specific commands.
- Runs in kernel mode (privileged)
- Provided by device manufacturers or OS vendors
- Abstracts hardware details from the OS
- Examples: printer driver, graphics driver, network adapter driver
Disk Scheduling Algorithms
Disk scheduling determines the order in which disk I/O requests are serviced to minimize seek time (time for disk head to move to the correct track).
Example: Disk head at position 53. Requests: 98, 183, 37, 122, 14, 124, 65, 67
- FCFS: Service in order of arrival. Simple but not optimal. Total movement: 640 cylinders.
- SSTF (Shortest Seek Time First): Service the request closest to current head position. Reduces seek time but may cause starvation. Total movement: 236 cylinders.
- SCAN (Elevator): Head moves in one direction, servicing requests, then reverses. Like an elevator. Total movement: 208 cylinders.
- C-SCAN (Circular SCAN): Head moves in one direction only. When it reaches the end, it jumps back to the beginning without servicing. More uniform wait times.
- LOOK: Like SCAN but head only goes as far as the last request in each direction (doesn't go to disk end).
Spooling and Buffering
- Buffering: Temporary storage of data in memory while it's being transferred between devices or between a device and an application. Smooths out speed differences between producer and consumer.
- Spooling (Simultaneous Peripheral Operations On-Line): Using disk as a buffer for I/O operations. Classic example: print spooling - print jobs are stored on disk and sent to the printer one at a time. Allows multiple processes to "print" simultaneously.
Level Up Your Operating system Skills
Master Operating system with these hand-picked resources
10,000+ learners
Free forever
Updated 2026
Related Operating System Topics