upgrade
upgrade

🖲️Operating Systems

Disk Scheduling Algorithms

Study smarter with Fiveable

Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.

Get Started

Why This Matters

Disk scheduling algorithms sit at the critical intersection of hardware constraints and software optimization—a theme you'll see repeatedly in operating systems. The mechanical reality of spinning platters and moving read/write heads creates a bottleneck that clever algorithms must navigate. You're being tested on your understanding of seek time minimization, fairness vs. efficiency tradeoffs, and starvation prevention—concepts that extend far beyond disk management into CPU scheduling, memory allocation, and resource management generally.

These algorithms also demonstrate a fundamental OS design principle: there's no perfect solution, only tradeoffs. Each algorithm sacrifices something (fairness, simplicity, or optimal seek time) to gain something else. When you encounter these on an exam, don't just memorize how each works—know why you'd choose one over another and what problems each solves or creates.


Simple Queue-Based Scheduling

The most intuitive approach treats disk requests like a line at a coffee shop: first in, first out. This provides maximum fairness but ignores the physical reality of disk geometry.

First-Come, First-Served (FCFS)

  • Processes requests in arrival order—no consideration of head position or seek distance
  • Convoy effect occurs when short requests queue behind long seeks, degrading throughput for everyone
  • Fairness guaranteed but performance suffers under heavy load; best for light, predictable workloads

Greedy Optimization Approaches

These algorithms prioritize minimizing immediate seek time, choosing the "closest" request next. They boost throughput but introduce fairness problems.

Shortest Seek Time First (SSTF)

  • Selects the request nearest to current head position—minimizes per-request seek time
  • Starvation risk is significant; requests at disk edges may wait indefinitely as closer requests keep arriving
  • Analogous to Shortest Job First (SJF) in CPU scheduling—same efficiency gains, same fairness tradeoffs

Compare: FCFS vs. SSTF—both are simple queue-based approaches, but FCFS guarantees fairness while SSTF optimizes for throughput. If an exam question asks about starvation, SSTF is your go-to example; if it asks about the convoy effect, use FCFS.


Elevator-Style Algorithms

These algorithms impose directional discipline on head movement, sweeping across the disk like an elevator moves through floors. This reduces erratic back-and-forth motion while providing more predictable wait times.

SCAN (Elevator Algorithm)

  • Head moves in one direction until reaching disk end, then reverses—services all requests in its path
  • Uniform wait times compared to SSTF, since requests aren't indefinitely skipped
  • Edge bias problem: requests just visited must wait for a full round-trip; requests at edges experience longer maximum waits

C-SCAN (Circular SCAN)

  • Head jumps back to start after reaching end—treats disk as circular, no servicing on return sweep
  • More uniform wait times than SCAN because all requests wait roughly the same duration
  • Maximum wait time reduced for beginning-of-disk requests; trades some efficiency for better fairness

Compare: SCAN vs. C-SCAN—both use directional sweeping, but SCAN services requests in both directions while C-SCAN only services in one. C-SCAN provides more predictable wait times at the cost of the "dead" return trip. FRQ tip: if asked to optimize for fairness among all cylinder positions, C-SCAN is stronger than SCAN.


Optimized Elevator Variants

These algorithms refine the elevator approach by eliminating unnecessary head movement to disk boundaries when no requests exist there.

LOOK Algorithm

  • Head reverses at the last request in each direction—doesn't travel to physical disk ends unnecessarily
  • Reduces wasted seek time compared to SCAN; the head "looks" for requests before deciding to reverse
  • Better average wait times while maintaining SCAN's fairness properties; practical default for many systems

C-LOOK Algorithm

  • Combines C-SCAN's circular approach with LOOK's efficiency—jumps to first request (not disk start) after servicing last
  • Minimizes both seek time and wait variance—eliminates two sources of wasted movement
  • Preferred in high-throughput environments where both efficiency and fairness matter; often the best general-purpose choice

Compare: LOOK vs. C-LOOK—same relationship as SCAN vs. C-SCAN. LOOK services bidirectionally while C-LOOK uses unidirectional sweeps with jumps. C-LOOK typically wins on fairness; LOOK may edge ahead on raw throughput in certain workloads.


Quick Reference Table

ConceptBest Examples
Simple/Fair schedulingFCFS
Greedy optimizationSSTF
Starvation riskSSTF, SCAN (at edges)
Elevator-style movementSCAN, C-SCAN, LOOK, C-LOOK
Uniform wait timesC-SCAN, C-LOOK
Efficiency optimizationLOOK, C-LOOK
Convoy effectFCFS
Circular disk treatmentC-SCAN, C-LOOK

Self-Check Questions

  1. Which two algorithms share the "elevator" movement pattern but differ in how they handle the return sweep? What's the practical impact of this difference?

  2. If a system experiences starvation where requests at cylinder 0 rarely get serviced, which algorithm is likely in use, and what would you recommend instead?

  3. Compare FCFS and SSTF: under what workload conditions would FCFS actually outperform SSTF?

  4. A system administrator notices the disk head frequently travels to the physical end of the disk even when no requests exist there. Which algorithm should replace the current one, and why?

  5. An FRQ asks you to design a scheduling approach that balances throughput and fairness for a busy file server. Which algorithm would you choose, and what tradeoffs would you acknowledge?