A disk has tracks from 0 to 179. Currently the head is at track 40. The R/W requests for tracks are in the following order- 80, 102, 26, 160, 35, 10, 135. What is the total head movement when SSTF algorithm is used?

A disk has tracks from 0 to 179. Currently the head is at track 40. The R/W requests for tracks are in the following order- 80, 102, 26, 160, 35, 10, 135. What is the total head movement when SSTF algorithm is used? Correct Answer 180

Concepts:

Sequence: 80, 102, 26, 160, 35, 10, 135

Algorithm: shortest seek time first

Arrange in ascending order: 10, 26, 35, 80, 102, 135, 160

Head is at cylinder: 40

Diagram:

[ alt="F1 R.S Deepak 1.11.2019 D1" src="//storage.googleapis.com/tb-img/production/19/11/F1_R.S_Deepak_1.11.2019_D1.png" style="width: 404px; height: 177px;">

Calculation:

Total Head movements= (40 - 35) + (35 - 26) + (26 - 10) + (80 - 10) + (102 - 80) + (135 - 102) + (160 - 135)

Total Head movements to serve all request = 5 + 9 + 16 + 70 + 22 + 33 + 25 = 180

Tips and Tricks:

Since the direction changes only once:

Total Head movements to serve all request = (40 – 10) + (160 – 10) = 180

Related Questions