# GATE | GATE-CS-2015 (Set 1) | Question 65

• Difficulty Level : Medium
• Last Updated : 19 Feb, 2021

Suppose the following disk request sequence (track numbers) for a disk with 100 tracks is given: 45, 20, 90, 10, 50, 60, 80, 25, 70. Assume that the initial position of the R/W head is on track 50. The additional distance that will be traversed by the R/W head when the Shortest Seek Time First (SSTF) algorithm is used compared to the SCAN (Elevator) algorithm (assuming that SCAN algorithm moves towards 100 when it starts execution) is _________ tracks
(A) 8
(B) 9
(C) 10
(D) 11

Explanation: In Shortest seek first (SSTF), closest request to the current position of the head, and then services that request next.

In SCAN (or Elevator) algorithm, requests are serviced only in the current direction of arm movement until the arm reaches the edge of the disk. When this happens, the direction of the arm reverses, and the requests that were remaining in the opposite direction are serviced, and so on.

```Given a disk with 100 tracks

And Sequence 45, 20, 90, 10, 50, 60, 80, 25, 70.

Initial position of the R/W head is on track 50.

In SSTF, requests are served as following

Next Served     Distance Traveled
50                   0
45                   5
60                  15
70                  10
80                  10
90                  10
25                  65
20                   5
10                  10
-----------------------------------
Total Dist         =  130

If Simple SCAN is used, requests are served as following

Next Served     Distance Traveled
50                   0
60                  10
70                  10
80                  10
90                  10
45                  65 [disk arm goes to 99, then to 45]
25                  20
20                   5
10                  10
-----------------------------------
Total Dist         =  140

Less Distance traveled in SSTF = 130 - 140 =  10 ```

Therefore, it is not additional but it is less distance traversed by SSTF than SCAN.

My Personal Notes arrow_drop_up