in Operating System edited by
8,524 views
28 votes
28 votes

A disk has $200$ tracks (numbered $0$ through $199$). At a given time, it was servicing the request of reading data from track $120$, and at the previous request, service was for track $90$. The pending requests (in order of their arrival) are for track numbers.

$30 \ 70 \ 115 \ 130 \ 110 \ 80 \ 20 \ 25.$

How many times will the head change its direction for the disk scheduling policies SSTF(Shortest Seek Time First) and FCFS (First Come First Serve)?

  1. $2$ and $3$
  2. $3$ and $3$
  3. $3$ and $4$
  4. $4$ and $4$
in Operating System edited by
8.5k views

3 Comments

edited by
Ans is C)3,4
0
0

Why is track 90 considered as the starting point of the head, when it is clearly mentioned to be the position of the head at an earlier request, and the requirement uses the term "how many times will the head change its direction"?

This information, in the question, could very well be redundant, given just to confuse the candidates.

0
0

 @ The starting point of the head is at 120, the previous was 90, which means the head was travelling in the MAX direction. This info is useful as if the next request is to be serviced in the MIN direction, it will be counted as a “change in direction” of the head.

3
3

4 Answers

46 votes
46 votes
Best answer

Answer is (C)

SSTF: $(90) \ 120 \ 115 \ 110 \ 130 \ 80 \ 70 \ 30 \ 25 \ 20$

Direction changes at $120,110,130$

FCFS: $(90) \ 120 \ 30 \ 70 \ 115 \ 130 \ 110 \ 80 \ 20 \ 25$

direction changes at $120,30,130,20$

edited by

4 Comments

i have one doubt, in sstf, while serving from 90 to 120, 110 and 115 are already covered, so why are we covering them again
1
1
those requests haven’t arrived till then
1
1

I have a doubt here: When r/w head is at 110 why it moved to 130, it should move to 90 because they both are at same distance away from 110, and the head will prefer not to change direction if there is tie between 2 distances?

So the answer for SSFT should be 2 and not 3: 

Direction changes at: 120, 20.

0
0
12 votes
12 votes

Ans C) 3,4

5 votes
5 votes
Here it is mentioned in the question that the disk was servicing request from track 120 and previously it has serviced track 90 so
from 90 to 120 it must move in one direction (lets consider this direction -->)  then from 120 it must read 115(SSTF) which is in (<---) direction.
So the answer is C.
0 votes
0 votes
According to Shortest Seek Time First:
90-> 120-> 115-> 110-> 130-> 80-> 70-> 30-> 25-> 20
Change of direction(Total 3); 120->15; 110->130; 130->80
According to First Come First Serve:
90-> 120-> 30-> 70-> 115-> 130-> 110-> 80-> 20-> 25
Change of direction(Total 4); 120->30; 30->70; 130->110;20->25
Answer:

Related questions