BIT204 · 2080 · 5 marks
Suppose that a disk drive has the cylinder numbered, 0 to 199 is currently serving a request at cylinder 143. The request queue is kept in the FIFO order 25, 17, 119, 197, 194, 15, 182, 115, and 183. What is the total head movement needed to satisfy these request for the following disk scheduling al
Suppose that a disk drive has the cylinder numbered, 0 to 199 is currently serving a request at cylinder 143. The request queue is kept in the FIFO order 25, 17, 119, 197, 194, 15, 182, 115, and 183. What is the total head movement needed to satisfy these request for the following disk scheduling algorithm. a) FCFS b) SSTF [5]
Disk Scheduling: FCFS and SSTF
Given Data
- Cylinder range: 0 to 199
- Current head position: 143
- Request queue (FIFO): 25, 17, 119, 197, 194, 15, 182, 115, 183
a) FCFS (First Come First Served)
Service order: 143 → 25 → 17 → 119 → 197 → 194 → 15 → 182 → 115 → 183
| From | To | Distance |
|---|---|---|
| 143 | 25 | 118 |
| 25 | 17 | 8 |
| 17 | 119 | 102 |
| 119 | 197 | 78 |
| 197 | 194 | 3 |
| 194 | 15 | 179 |
| 15 | 182 | 167 |
| 182 | 115 | 67 |
| 115 | 183 | 68 |
$$\text{Total} = 118+8+102+78+3+179+167+67+68 = 790$$
FCFS total head movement = 790 cylinders
b) SSTF (Shortest Seek Time First)
Always move to the nearest pending request.
At every step the head jumps to whichever pending cylinder is closest, so the distances to all remaining requests are compared before each move.
| Current | Nearest pending options | Chosen | Distance |
|---|---|---|---|
| 143 | 119 (24), 115 (28), 182 (39) | 119 | 24 |
| 119 | 115 (4), 182 (63), 183 (64) | 115 | 4 |
| 115 | 182 (67), 183 (68), 25 (90) | 182 | 67 |
| 182 | 183 (1), 194 (12), 197 (15) | 183 | 1 |
| 183 | 194 (11), 197 (14) | 194 | 11 |
| 194 | 197 (3), 25 (169) | 197 | 3 |
| 197 | 25 (172), 17 (180) | 25 | 172 |
| 25 | 17 (8), 15 (10) | 17 | 8 |
| 17 | 15 (2) | 15 | 2 |
Service order: 143 → 119 → 115 → 182 → 183 → 194 → 197 → 25 → 17 → 15
$$\text{Total} = 24+4+67+1+11+3+172+8+2 = 292$$
SSTF total head movement = 292 cylinders
Note that 119 has to be taken before 115, since $|143-119| = 24$ is smaller than $|143-115| = 28$. Servicing 115 first would violate the shortest-seek rule even though the two requests sit close together.
Summary
| Algorithm | Total Head Movement |
|---|---|
| FCFS | 790 cylinders |
| SSTF | 292 cylinders |
SSTF greatly reduces head movement versus FCFS, at the risk of starvation for distant requests.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.