I/O is the slowest subsystem in a computer. Disk scheduling algorithms minimize the time spent moving the disk arm (seek time) to service I/O requests.
Disk Performance Metrics
| Metric | What it measures | Typical value |
|---|---|---|
| Seek time | Moving arm to the correct cylinder | 4-10 ms |
| Rotational latency | Waiting for the right sector under the head | 2-5 ms (7200 RPM → 4.17 ms avg) |
| Transfer time | Reading/writing the data | Depends on size and bandwidth |
| Total access time | Seek + Rotational + Transfer | 10-20 ms |
Disk Scheduling Algorithms
| Algorithm | How it works | Pros | Cons |
|---|---|---|---|
| FCFS | Service requests in arrival order | Fair, simple | Worst seek time |
| SSTF | Service closest request first | Low average seek time | Starvation for edge tracks |
| SCAN (Elevator) | Sweep across disk, service requests along the way | No starvation | Tracks at edges wait longer |
| C-SCAN | Sweep one direction only, then jump back | Uniform waiting time | More seeks than SCAN |
| LOOK / C-LOOK | Reverses direction only at the last request (not disk end) | More efficient than SCAN | Slightly more complex |
SCAN vs C-SCAN
SCAN moves back and forth like an elevator. C-SCAN only services requests in one direction (e.g., inward), then immediately jumps to the outer edge and repeats. C-SCAN gives more uniform waiting times — no cylinder is unfairly preferred.
DMA (Direct Memory Access)
Without DMA: CPU reads each byte from the device into a register, then stores it to memory — programmed I/O (PIO). The CPU is busy the entire time.
With DMA: CPU tells the DMA controller: “copy 4KB from disk to address 0x1000.” The CPU resumes work. The DMA controller handles the transfer and interrupts the CPU only when done.
Buffering vs Spooling
| Buffering | Spooling | |
|---|---|---|
| Purpose | Overlap I/O of one process with its computation | Overlap I/O of one process with computation of another process |
| Example | Reading a file in chunks while processing | Print spooler — multiple processes queue print jobs |
| Storage | Memory | Disk |
Q: What is seek time vs rotational latency?
A: Seek time is the time for the disk arm to move to the correct cylinder. Rotational latency is the time waiting for the target sector to spin under the head. Total access time = seek + rotational latency + transfer time.
Q: Why is C-SCAN often preferred over SCAN?
A: C-SCAN provides more uniform waiting times. In SCAN, cylinders near the middle get serviced twice per pass while edge cylinders wait longer. C-SCAN treats all cylinders equally by only servicing in one direction.
Q: Why do we use DMA?
A: Without DMA, the CPU must move every byte from device to memory — wasting billions of cycles. DMA lets the CPU initiate the transfer and do other work while a dedicated controller handles the data movement.
Q: What’s the difference between buffering and spooling?
A: Buffering stores data temporarily to handle speed mismatches within a single process. Spooling (Simultaneous Peripheral Operation Online) overlaps I/O of one job with computation of another — like printing documents while you work.
Premium Content
Unlock Disk Scheduling & I/O and all premium lessons with a subscription.
From ₹199.99/year — See plans