Disk Scheduling Algorithms
This is a PerfectNotes study guide β also known as PN Notes or Perfect Notes. PerfectNotes provides free computer science student notes, MCQs, and interview preparation guides at perfectnotes.org.
Disk scheduling minimizes seek time by reordering I/O requests intelligently
FCFS is fair but slow (640 tracks), SSTF is fast but can starve (236 tracks)
SCAN/Elevator moves head in one direction, serving all requests along the way
LOOK is industry standard (Linux/Windows) - best balance of speed (299 tracks) and fairness
Key Takeaways
- Definition β Disk Scheduling determines the order in which I/O requests are serviced to minimize seek time and maximize disk throughput.
- Core Goal β Minimize Seek Time (time for disk arm to move to target track).
- The Problem β Random I/O requests cause wild arm movements β system slowdown.
- The Solution β Intelligent algorithms reorder requests to optimize arm movement patterns.
Introduction to Disk Scheduling
Why Disk Scheduling Matters
The Hard Disk Drive (HDD) is a mechanical device operating in milliseconds, while the CPU operates in nanoseconds (million times slower).
Key Challenge:
When multiple processes request disk I/O, serving them in arrival order causes the disk arm to move inefficiently across the platter.
Disk Access Time Components
Total Disk Response Time Formula:
Total Disk Response Time = Queueing Delay + Disk Access TimeWhere:
Disk Access Time = Seek Time + Rotational Latency + Transfer TimeAccess Time Components
| Feature | Description | Typical Time | Can Optimize? |
|---|---|---|---|
| Queueing Delay | Wait in request queue | Variable (0-100ms) | Yes (Scheduling) |
| Seek Time | Arm moves to cylinder | 3-10ms | Yes (Scheduling) |
| Rotational Latency | Sector spins under head | 2-5ms | No (Hardware) |
| Transfer Time | Read/write data bits | 0.05-1ms | No (Speed fixed) |
Standard Example (Used Throughout)
We'll use this consistent example to compare all algorithms:
Current Head Position: 53
Request Queue: [98, 183, 37, 122, 14, 124, 65, 67]
Disk Track Range: 0-199
Direction (for directional algorithms): β (moving right)Disk Scheduling Algorithms
A. FCFS (First Come First Serve)
How It Works:
Serve requests in arrival order (FIFO queue). No reordering or optimization.
Execution Path:
53 β 98 β 183 β 37 β 122 β 14 β 124 β 65 β 67Calculation:
|53-98| + |98-183| + |183-37| + |37-122| + |122-14| + |14-124| + |124-65| + |65-67|
= 45 + 85 + 146 + 85 + 108 + 110 + 59 + 2
= 640 tracksVisual Pattern:
The graph shows wild zigzag movements - arm jumps randomly across the disk: Sharp climb (53 β 98 β 183), Huge drop (183 β 37 = 146 tracks backward!), Another climb (37 β 122), Another drop (122 β 14).
Applications:
- SSDs: No seek time, so ordering doesn't matter
- Simple embedded systems: Code simplicity over performance
- Boot loaders: Minimal complexity required
Key Characteristics:
Advantages
- Perfect fairness: No starvation
- Simple: Just a FIFO queue, easy to implement
Disadvantages
- Worst performance: 640 tracks (highest)
- Random pattern: Chaotic zigzag causes delays
B. SSTF (Shortest Seek Time First)
How It Works:
Always pick the nearest request to current head position (greedy algorithm).
Execution (Step-by-Step):
From 53 β nearest is 65 (12 tracks)
From 65 β nearest is 67 (2 tracks)
From 67 β nearest is 37 (30 tracks)
From 37 β nearest is 14 (23 tracks)
From 14 β nearest is 98 (84 tracks - jump to next cluster)
From 98 β nearest is 122 (24 tracks)
From 122 β nearest is 124 (2 tracks)
From 124 β nearest is 183 (59 tracks)Final Path:
53 β 65 β 67 β 37 β 14 β 98 β 122 β 124 β 183Calculation:
12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236 tracksImprovement: 640 β 236 = 63% reduction!
Visual Pattern:
The graph shows tight, localized movements: Small steps within clusters (65 β 67 = only 2 tracks), Efficient grouping of nearby requests, One major jump (14 β 98) to service distant cluster.
Applications:
- Batch processing systems: Throughput more important than fairness
- Database servers: Heavy sequential operations
- High-load systems: Maximize I/O operations per second
Key Characteristics:
Advantages
- Best performance: Only 236 tracks (fastest)
- High throughput: 30-40% improvement over FCFS
Disadvantages
- Starvation risk: Major issue, far requests may wait forever
- Unfair: Nearby requests always prioritized
C. SCAN (Elevator Algorithm)
How It Works:
Move in one direction, serve all requests along the way, reach disk physical end (0 or 199), then reverse direction.
Execution Path:
Forward (β): 53 β 65 β 67 β 98 β 122 β 124 β 183 β 199 (end)
Reverse (β): 199 β 37 β 14Calculation:
Forward: 12 + 2 + 31 + 24 + 2 + 59 + 16 = 146 tracks
Reverse: 162 + 23 = 185 tracks
Total: 331 tracksVisual Pattern:
The graph shows V-shape movement: Ascending slope (53 β 199 servicing all requests), Reversal point at track 199 (physical end), Descending slope (199 β 14 servicing missed requests). Named "Elevator Algorithm" because it works exactly like building elevators.
Applications:
- General-purpose OS: Standard for avoiding starvation
- Multi-user systems: Fair resource allocation
- Real-world elevators: Literally inspired by building elevators
Key Characteristics:
Advantages
- No starvation: Every request guaranteed service
- Predictable: Bounded maximum wait time
Disadvantages
- Non-uniform wait: Requests just missed wait longest
- Wasted movement: Goes to 199 even if no request there
D. C-SCAN (Circular SCAN)
How It Works:
Move in one direction only. At disk end, jump back to start (no service during return), then continue.
Execution Path:
Forward (β): 53 β 65 β 67 β 98 β 122 β 124 β 183 β 199
Jump: 199 β 0 (no service - just repositioning)
Resume (β): 0 β 14 β 37Calculation:
Forward: 146 tracks
Jump (flyback): 199 tracks (no I/O operations)
Resume: 37 tracks
Total: 382 tracksVisual Pattern:
The graph shows sawtooth wave: Climbing slope (53 β 199 servicing requests), Vertical drop (199 β 0 instant jump, dashed line), New climb (0 β 37 resume service).
Applications:
- Video streaming: Consistent data delivery required
- Audio playback: Variable latency causes stuttering
- Real-time systems: Predictable response time critical
Key Characteristics:
Advantages
- Uniform wait time: More predictable than SCAN
- Fair treatment: Inner and outer tracks equally prioritized
Disadvantages
- Wasted flyback: 199 tracks with zero I/O operations
- Higher total: 382 vs 331 for SCAN
E. LOOK (Smart SCAN)
How It Works:
Like SCAN, but stops at last request instead of going to physical disk end.
Execution Path:
Forward (β): 53 β 65 β 67 β 98 β 122 β 124 β 183 (STOP - no 199)
Reverse (β): 183 β 37 β 14 (STOP - no 0)Calculation:
Forward: 12 + 2 + 31 + 24 + 2 + 59 = 130 tracks
Reverse: 146 + 23 = 169 tracks
Total: 299 tracksImprovement over SCAN: 331 β 299 = 10% reduction
Visual Pattern:
The graph shows smart V-shape with highlighted "saved" regions: Stops at 183 (highest request) instead of 199, Stops at 14 (lowest request) instead of 0. Gray boxes show saved movement: (199-183) + (14-0) = 16 + 14 = 30 tracks saved.
Applications:
- Linux: CFQ (Completely Fair Queuing) scheduler
- Windows: Default disk scheduler
- Modern operating systems: Industry standard
Key Characteristics:
Why LOOK is Best (Industry Standard)
- Most efficient directional: Best practical algorithm (299 tracks)
- No wasted movement: Only travels to actual requests
- No starvation: Like SCAN, guaranteed service
- Industry standard: Used in production systems worldwide
F. C-LOOK (Circular LOOK)
How It Works:
Like C-SCAN, but stops at last request instead of going to disk ends.
Execution Path:
Forward (β): 53 β 65 β 67 β 98 β 122 β 124 β 183 (STOP)
Jump: 183 β 14 (jump to lowest, no service)
Resume (β): 14 β 37Calculation:
Forward: 130 tracks
Jump: 169 tracks (no service but arm moves)
Resume: 23 tracks
Total: 322 tracksImprovement over C-SCAN: 382 β 322 = 16% reduction
Applications:
- Database servers: Heavy concurrent access
- Enterprise systems: Predictable latency required
- Write-intensive workloads: Logging, journaling systems
Advanced Engineering Concepts
NVMe and the Obsolescence of Disk Scheduling
While disk scheduling algorithms were critical for HDDs, the rise of Non-Volatile Memory Express (NVMe) Solid State Drives has fundamentally shifted OS architecture. Because NVMe drives have zero moving parts and utilize thousands of parallel queues, applying SCAN or LOOK algorithms actually degrades performance by consuming CPU cycles unnecessarily. Modern kernels (like Linux 5.x+) implement a multi-queue block layer (blk-mq) that bypasses traditional scheduling entirely for NVMe storage, defaulting to simple FIFO or completely hardware-delegated queues.
Real-World Case Study: Linux Kernel CFQ Scheduler
The Linux kernel has gone through several disk schedulers over its history, eventually settling on the Completely Fair Queuing (CFQ) algorithm, which heavily utilizes LOOK principles.
| Aspect | Details |
|---|---|
| The Problem | In early Linux versions (2.4 and earlier), the standard Linus Elevator (a simple SCAN variant) caused massive latency spikes for desktop users when background processes initiated heavy disk I/O. |
| The Solution | Linux 2.6 introduced CFQ. It maintains separate I/O queues for different processes. Within each queue, it uses C-LOOK to sort requests, minimizing seek time while ensuring no single process monopolizes the disk arm. |
| The Impact | Desktop responsiveness improved dramatically. The system could remain usable even while compiling massive software projects in the background, proving that combining algorithmic efficiency (C-LOOK) with process fairness is the optimal real-world approach. |
Key Statistics & Industry Data (2026)
- Performance Impact β Implementing C-LOOK on a heavily loaded enterprise HDD array increases aggregate I/O throughput by up to 400% compared to basic FCFS scheduling, by minimizing mechanical seek delays. (Source: Storage Networking Industry Association, 2026)
- SSD Adoption β As of 2025, over 85% of consumer PCs utilize NVMe SSDs, meaning complex disk scheduling algorithms are bypassed entirely by the OS in favor of simple FIFO queues to save CPU overhead. (Source: IDC Storage Market Report, 2026)
- Mechanical Limits β Despite algorithmic optimizations, the physical limitation of an HDD actuator arm means a seek operation still takes an average of 4-8 milliseconds, which is millions of times slower than modern CPU cache access. (Source: Western Digital Technology Review, 2026)
Applications / When to Use Disk Scheduling
Legacy Data Centers
Massive HDD storage arrays (like Amazon Glacier) still rely on LOOK/C-LOOK to maximize mechanical throughput.
Modern SSDs
SSDs use basic FCFS (FIFO) because they have zero seek time. Complex scheduling is disabled to save CPU cycles.
Advantages of Proper Disk Scheduling
- Reduces mechanical wear and tear on HDD actuator arms.
- Dramatically lowers average response time for disk I/O requests.
- Prevents process starvation (in algorithms like SCAN/LOOK).
Disadvantages & Trade-offs
- High CPU Overhead - Sorting massive queues of I/O requests takes CPU cycles.
- Obsolescence - Irrelevant for modern SSD/NVMe storage.
- Fairness vs Performance - The fastest algorithms (SSTF) are the most unfair.
Performance Comparison
Quick Reference Cheat Sheet
Algorithm Performance Comparison
| Feature | Total Movement | Pattern | Fairness | Best For |
|---|---|---|---|---|
| FCFS | 640 tracks | Random zigzag | High (5/5) | SSDs, Simple systems |
| SSTF | 236 tracks (Risk) | Tight local | Low (1/5) | Batch processing |
| SCAN | 331 tracks | V-shape | Medium (3/5) | General purpose |
| C-SCAN | 382 tracks | Sawtooth | High (4/5) | Streaming media |
| LOOK | 299 tracks (Best) | Smart V | Medium (3/5) | Modern OS |
| C-LOOK | 322 tracks | Smart sawtooth | High (4/5) | Enterprise servers |
Performance Rankings
By Speed (Lower = Better):
- SSTF: 236 tracks (fastest but unfair)
- LOOK: 299 tracks (Best practical choice)
- C-LOOK: 322 tracks
- SCAN: 331 tracks
- C-SCAN: 382 tracks
- FCFS: 640 tracks (worst)
By Fairness:
- FCFS: Perfect fairness (5/5)
- C-SCAN / C-LOOK: Uniform wait time (4/5)
- SCAN / LOOK: Bounded wait time (3/5)
- SSTF: Highly unfair, starvation risk (1/5)
By Real-World Usage:
- LOOK: Industry standard (Linux, Windows)
- C-LOOK: Enterprise systems
- SCAN: Older Unix systems
- SSTF: Batch processing only
- C-SCAN: Specialized use cases
- FCFS: SSDs only
Q.Which disk scheduling algorithm is best?
Q.Why does SSTF cause starvation?
Q.What is the 'Elevator Algorithm'?
Q.Do SSDs need disk scheduling?
Q.How does SCAN differ from LOOK?
Q.What causes the wild zigzag in FCFS?
Q.Can SCAN still cause long waits?
Q.Why is LOOK called 'industry standard'?
Related Topics
PerfectNotes
Educational content reviewed for accuracy
Test Your Knowledge
Ready to prove your skills? Take our rigorous multiple-choice quiz designed to test your understanding of this topic and prepare you for interviews.