Problem Setup:
Number of cylinders: 0 to 199.
Current position: 90.
Queue: 15, 41, 144, 93, 73, 179, 137, 125, 69, 45, 36, 11.
1.First Come, First Serve (FCFS):
In FCFS, the requests are processed in the order they arrive in the queue.
Queue order: 15, 41, 144, 93, 73, 179, 137, 125, 69, 45, 36, 11.
Head movement calculation:
( |90 - 15| + |15 - 41| + |41 - 144| + |144 - 93| + |93 - 73| + |73 - 179| + |179 - 137| + |137 - 125| + |125 - 69| + |69 - 45| + |45 - 36| + |36 - 11| \)
2.LOOK:
LOOK moves towards the nearest end of the disk, servicing requests along the way, then reverses direction when no further requests exist in that direction.
Queue order (sorted): 11, 15, 36, 41, 45, 69, 73, 93, 125, 137, 144, 179.
- Starting at 90, first move to service requests in the direction of increasing cylinder numbers (93, 125, ..., 179), then reverse to service the lower requests (69, ..., 11).
Head movement calculation:
- Forward: ( |90 - 93| + |93 - 125| + |125 - 137| + |137 - 144| + |144 - 179| )
- Backward: ( |179 - 73| + |73 - 69| + |69 - 45| + |45 - 41| + |41 - 36| + |36 - 15| + |15 - 11| )
3.SCAN:
SCAN (also called the Elevator Algorithm) moves in one direction to the end of the disk, servicing all requests along the way, then reverses direction.
Queue order (sorted): 11, 15, 36, 41, 45, 69, 73, 93, 125, 137, 144, 179.
- Starting at 90, move toward the nearest end (in this case, decreasing direction), reach the last request (11), then reverse to service the higher requests.
**Head movement calculation:**
- Downward: ( |90 - 73| + |73 - 69| + |69 - 45| + |45 - 41| + |41 - 36| + |36 - 15| + |15 - 11| )
- Upward: ( |11 - 93| + |93 - 125| + |125 - 137| + |137 - 144| + |144 - 179| )
4. Shortest Seek Time First (SSTF):
SSTF chooses the request closest to the current head position.
Queue processing:
1. From 90, the closest request is 93.
2. From 93, the closest is 73.
3. Continue this process.
Queue order based on proximity: 93, 73, 69, 45, 41, 36, 15, 11, 125, 137, 144, 179.
Head movement calculation:
( |90 - 93| + |93 - 73| + |73 - 69| + |69 - 45| + |45 - 41| + |41 - 36| + |36 - 15| + |15 - 11| + |11 - 125| + |125 - 137| + |137 - 144| + |144 - 179|)
I’ll now compute the total head movements for each algorithm.
Total Head Movements for Each Algorithm:
1. FCFS: 549 cylinders
2. LOOK: 257 cylinders
3. SCAN: 247 cylinders
4. SSTF: 253 cylinders