Comparison of Disk Scheduling Algorithms (FCFS, SSTF, SCAN, C-SCAN, LOOK)
Comparison of Disk Scheduling Algorithms (FCFS, SSTF, SCAN, C-SCAN, LOOK)
Aim
To implement and compare the disk scheduling algorithms FCFS, SSTF, SCAN, C-SCAN, and LOOK using the same set of disk requests and compute their total head movements.
Objectives
-
Understand different disk scheduling techniques
-
Measure total seek movement
-
Compare efficiency of algorithms
Theory
1. FCFS (First Come First Serve)
-
Services requests in arrival order
-
Simple but inefficient
-
Can cause large head movement
2. SSTF (Shortest Seek Time First)
-
Selects nearest request from current head
-
Reduces seek time
-
May cause starvation
3. SCAN (Elevator Algorithm)
-
Head moves in one direction servicing requests
-
Goes to disk end, then reverses
-
Better fairness than SSTF
4. C-SCAN (Circular SCAN)
-
Head moves in one direction only
-
After reaching disk end, jumps to start
-
Provides uniform waiting time
5. LOOK
-
Similar to SCAN
-
Does not go to disk end
-
Stops at last request and reverses
-
Saves unnecessary movement
Algorithm (General Steps)
-
Input number of disk requests.
-
Input request queue.
-
Input initial head position.
-
Input disk size.
-
Apply each algorithm:
-
FCFS → sequential service
-
SSTF → choose nearest request
-
SCAN → move to end then reverse
-
C-SCAN → move to end then jump to start
-
LOOK → reverse at last request
-
-
Compute total head movement.
-
Display comparison table.
Program (C Implementation)
Sample Input
Sample Output
Observation
-
SSTF gives minimum movement but may cause starvation
-
LOOK reduces unnecessary travel compared to SCAN
-
C-SCAN provides uniform waiting time
-
FCFS is simplest but inefficient
Result
The disk scheduling algorithms FCFS, SSTF, SCAN, C-SCAN, and LOOK were successfully implemented and compared.
Among them, SSTF produced the least head movement for the given input.
Comments
Post a Comment