SSTF Disk Scheduling (Shortest Seek Time First)
SSTF Disk Scheduling (Shortest Seek Time First)
🔷 What is SSTF?
SSTF selects the disk request that is closest to the current head position.
👉 Key idea:
-
Always service the request with minimum seek distance
1. How SSTF Works
🔷 Step-by-Step
-
Start at current head position
-
Find the request nearest to current position
-
Move head to that request
-
Repeat until all requests are served
2. Example
🔹 Given:
-
Request queue:
-
Initial head position:
🔷 Step-by-Step Execution
Step 1: From 53
Closest request:
-
65 (distance = 12)
-
67 (14)
-
37 (16)
👉 Choose 65
Step 2: From 65
Remaining:
Closest:
-
67 (2)
👉 Choose 67
Step 3: From 67
Closest:
-
37 (30)
-
98 (31)
👉 Choose 37
Step 4: From 37
Closest:
-
14 (23)
👉 Choose 14
Step 5: From 14
Closest:
-
98 (84)
-
122 (108)
👉 Choose 98
Step 6: From 98
Closest:
-
122 (24)
-
124 (26)
👉 Choose 122
Step 7: From 122
Closest:
-
124 (2)
👉 Choose 124
Step 8: From 124
Remaining:
-
183
👉 Choose 183
🔷 Final Order of Service
3. Total Head Movement
👉 Total = 236 cylinders
4. Advantages
✅ 1. Reduced Seek Time
-
Much less movement than FCFS (640 → 236)
✅ 2. Better Performance
-
Faster response time
5. Disadvantages
🔴 1. Starvation
-
Requests far from head may wait indefinitely
🔴 2. Not Fair
-
Favors nearby requests
6. Key Insight
👉 SSTF is like Shortest Job First (SJF) in CPU scheduling:
-
Always picks nearest request
-
Optimizes performance but may ignore distant requests
7. Comparison Snapshot
| Algorithm | Total Movement | Efficiency |
|---|---|---|
| FCFS | 640 | Poor |
| SSTF | 236 | Much better |
8. Simple Analogy
-
Like a delivery person:
-
Always goes to the nearest house next
-
Saves fuel, but far houses wait longer
-
9. Key Takeaway
-
SSTF selects request with minimum seek time
-
Improves performance significantly
-
May cause starvation
Comments
Post a Comment