To determine the total distance the disk arm moves using the Shortest Seek Time First (SSTF) disk scheduling algorithm, we start from the current head position (cylinder 289) and at each step, move to the request that is closest to the current position. This minimizes the seek time (movement of the disk arm) at each step.
Here are the steps to calculate the total movement:
- Current position: 289
- Pending requests: 36, 107, 2938, 3774, 6948, 1507, 2012, 7750, 1300
To find the next closest request:
- Compute the difference (absolute value) between the current position and each of the pending requests.
- Move to the closest one and repeat until all requests are satisfied.
Step-by-Step Execution:
-
Requests: 36, 107, 2938, 3774, 6948, 1507, 2012, 7750, 1300
-
Current Position: 289
- Distance to 36 = |289 - 36| = 253
- Distance to 107 = |289 - 107| = 182
- Distance to 1300 = |289 - 1300| = 1011
- Distance to 1507 = |289 - 1507| = 1218
- Distance to 2012 = |289 - 2012| = 1723
- Distance to 2938 = |289 - 2938| = 2649
- Distance to 3774 = |289 - 3774| = 3485
- Distance to 6948 = |289 - 6948| = 6659
- Distance to 7750 = |289 - 7750| = 7461
Move to 107 (182 cylinders).
-
Requests: 36, 2938, 3774, 6948, 1507, 2012, 7750, 1300
-
Current Position: 107
- Distance to 36 = |107 - 36| = 71
- Distance to 1300 = |107 - 1300| = 1193
- Distance to 1507 = |107 - 1507| = 1400
- Distance to 2012 = |107 - 2012| = 1905
- Distance to 2938 = |107 - 2938| = 2831
- Distance to 3774 = |107 - 3774| = 3667
- Distance to 6948 = |107 - 6948| = 6841
- Distance to 7750 = |107 - 7750| = 7643
Move to 36 (71 cylinders).
-
Requests: 2938, 3774, 6948, 1507, 2012, 7750, 1300
-
Current Position: 36
- Distance to 1300 = |36 - 1300| = 1264
- Locate closest requests similarly...
Continue the process until all requests are addressed. At each step:
- Choose the closest cylinder.
- Update the current head position.
- Calcuate and sum up the travel distance from the last position to the new one.
Total Distance Calculation:
- From 289 to 107: 182 cylinders
- From 107 to 36: 71 cylinders
- From 36 to 1300: 1264 cylinders
- From 1300 to 1507: 207 cylinders
- From 1507 to 2012: 505 cylinders
- From 2012 to 2938: 926 cylinders
- From 2938 to 3774: 836 cylinders
- From 3774 to 6948: 3174 cylinders
- From 6948 to 7750: 802 cylinders
Total Distance:
182 + 71 + 1264 + 207 + 505 + 926 + 836 + 3174 + 802 = 8967 cylinders
Thus, using the SSTF scheduling algorithm, the total distance the disk arm needs to move is 8967 cylinders.