Learning outcomes
- Summarise the basic types of I/O devices and the structure of I/O subsystems.
These notes explain the basic ideas of I/O management, including I/O devices, device controllers, I/O subsystems, buffering, disk structure, disk scheduling, and RAID. These topics are important because I/O devices are much slower than the CPU, so the operating system must carefully coordinate data transfer and storage access for good overall performance.
An I/O device is any hardware unit used to input data into the computer, output data from the computer, or transfer data between the system and the outside world.
Each I/O device works at its own speed and has its own control method. Because of this variety, the operating system hides device-specific details through device drivers and the I/O subsystem.
| Component | Role |
|---|---|
| Device Controller | Hardware unit that controls a particular device and provides registers / local buffer for communication. |
| Device Driver | Software module inside the operating system that knows how to operate the controller. |
The I/O subsystem is the part of the operating system that manages all I/O activity. It provides a uniform interface to different devices and hides low-level hardware complexity from user programs.
| Method | Idea | Drawback / Strength |
|---|---|---|
| Programmed I/O | CPU repeatedly checks device status and transfers data itself. | Simple but wastes CPU time. |
| Interrupt-driven I/O | Device interrupts CPU when service is needed or transfer completes. | Better CPU utilization. |
| DMA | Direct Memory Access controller transfers a block directly between device and memory. | Efficient for high-speed block transfer. |
A buffer is a temporary memory area used to hold data while it is being transferred between two devices or between a device and a process.
Buffering is needed because:
| Type | Meaning | Use |
|---|---|---|
| Single Buffering | One buffer is used between process and device. | Simple, but overlap is limited. |
| Double Buffering | Two buffers are used so one can be filled while the other is processed. | Improves overlap of CPU and I/O. |
| Circular Buffering | More than two buffers arranged in a ring. | Useful for continuous streams like audio or network traffic. |
While a disk controller fills Buffer A with the next block, the CPU can process data already present in Buffer B. This overlap improves throughput.
Traditional magnetic disks store data on rotating platters. Each platter surface is divided into:
Access time depends on:
Many processes may request disk access at the same time. Since seek time is a major delay, the OS uses disk scheduling algorithms to reduce total head movement and improve performance.
| Algorithm | Idea | Strength | Weakness |
|---|---|---|---|
| FCFS | Serve requests in arrival order. | Simple and fair. | Poor average seek performance. |
| SSTF | Choose request nearest to current head position. | Lower seek time than FCFS. | May starve far-away requests. |
| SCAN | Head moves in one direction serving requests, then reverses. | Good throughput, less starvation. | Requests at ends may wait longer. |
| C-SCAN | Serve in one direction only; jump back to start. | More uniform waiting time. | Extra return movement. |
| LOOK | Like SCAN, but reverses at last actual request instead of physical end. | Efficient, avoids unnecessary travel. | Still direction-sensitive. |
Request sequence:
Initial head position:
RAID combines multiple physical disks into one logical unit to improve:
One large storage system built from multiple disks can often provide better speed and fault tolerance than a single large disk.
| RAID Level | Main Idea | Advantage | Limitation |
|---|---|---|---|
| RAID 0 | Striping only, no redundancy | High performance | No fault tolerance |
| RAID 1 | Mirroring | High reliability, simple recovery | Needs double storage |
| RAID 5 | Block striping with distributed parity | Good balance of speed and fault tolerance | Parity update overhead |
| RAID 6 | Distributed dual parity | Can survive two disk failures | Higher overhead than RAID 5 |
| RAID 10 (1+0) | Mirroring + striping | Very good performance and reliability | Expensive due to extra disks |
In RAID 5, parity is distributed across all disks rather than placed on a single parity disk. This avoids overloading one parity drive. RAID 6 extends this idea by storing two independent redundant values, allowing recovery from two simultaneous disk failures.
Combined RAID schemes are also common:
RAID 10 is often preferred in high-performance environments because it offers both speed and stronger fault tolerance than simple striping.
| Topic | Main idea | What to remember |
|---|---|---|
| I/O Devices | External hardware for input, output, storage, and communication | Different speeds and control methods require OS management |
| I/O Subsystem | OS component that manages device access | Uses drivers, interrupts, DMA, buffering |
| Buffering | Temporary storage during transfer | Helps match speed differences and overlap CPU/I/O |
| Disk Scheduling | Order of servicing disk requests | Reduces head movement and seek time |
| RAID | Multiple disks combined for speed and/or reliability | RAID 0 = speed, RAID 1 = mirroring, RAID 5 = parity, RAID 10 = both |
I/O management is the responsibility of the operating system for controlling device access, hiding device differences, and coordinating data transfer efficiently.
I/O devices include input, output, storage, and communication devices. The operating system interacts with them through device drivers and controllers.
I/O buffering uses temporary memory areas to reduce speed mismatch between devices and processes and to improve overlap between I/O and CPU execution.
Disk scheduling improves performance by reducing head movement. Important algorithms include FCFS, SSTF, SCAN, C-SCAN, and LOOK.
RAID combines multiple disks to improve performance, reliability, or both. Common levels are RAID 0, RAID 1, RAID 5, RAID 6, and RAID 10.