Question

Suppose the following disk request sequence (track numbers) for a disk with 100100 tracks is given: 45,20,90,10,50,60,80,25,7045, 20, 90, 10, 50, 60, 80, 25, 70. Assume that the initial position of the R/W head is on track 5050. 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 100100 when it starts execution) is _____ tracks.

Official answer and solution
Official answer
10
From
Official GATE 2015 answer key

Solution

Simulate the head movement path under SSTF and SCAN algorithms and find their difference.

Given requests: 45,20,90,10,50,60,80,25,7045, 20, 90, 10, 50, 60, 80, 25, 70.
Initial head position: track 5050.
Note that request 5050 is serviced immediately with distance 00.

  1. SSTF (Shortest Seek Time First):
  • From 5050, remaining requests are {10,20,25,45,60,70,80,90}\{10, 20, 25, 45, 60, 70, 80, 90\}.
  • Closest to 5050 is 4545 (distance ∣50−45∣=5|50 - 45| = 5).
  • From 4545, closest is 6060 (distance ∣45−60∣=15|45 - 60| = 15, whereas ∣45−25∣=20|45 - 25| = 20).
  • From 6060, closest is 7070 (distance ∣60−70∣=10|60 - 70| = 10).
  • From 7070, closest is 8080 (distance ∣70−80∣=10|70 - 80| = 10).
  • From 8080, closest is 9090 (distance ∣80−90∣=10|80 - 90| = 10).
  • From 9090, the head must reverse and service remaining left requests: 25→20→1025 \to 20 \to 10.
    Distance from 9090 to 10=90−10=8010 = 90 - 10 = 80.
  • Total SSTF head movement:
    DistSSTF=5+15+10+10+10+80=130 tracks.\text{Dist}_{\text{SSTF}} = 5 + 15 + 10 + 10 + 10 + 80 = 130\text{ tracks}.
  1. SCAN (Elevator) moving towards track 100:
  • Head starts at 5050 and moves upward to track 100100:
    Distance =100−50=50 tracks= 100 - 50 = 50\text{ tracks}, servicing 60,70,80,9060, 70, 80, 90.
  • Head reverses at track 100100 and moves downward to the lowest request (track 1010):
    Distance =100−10=90 tracks= 100 - 10 = 90\text{ tracks}, servicing 45,25,20,1045, 25, 20, 10.
  • Total SCAN head movement:
    DistSCAN=(100−50)+(100−10)=50+90=140 tracks.\text{Dist}_{\text{SCAN}} = (100 - 50) + (100 - 10) = 50 + 90 = 140\text{ tracks}.
  1. Difference:
Additional tracks=∣140−130∣=10 tracks.\text{Additional tracks} = |140 - 130| = 10\text{ tracks}.

The additional distance is 1010 tracks.

Final answer

10

Common trap

Assuming LOOK instead of SCAN (LOOK reverses at 90 instead of traveling to boundary 100).

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 1
Question
40 of 65, printed as CS Q.30
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.