edited by
23,165 views
94 votes
94 votes

The head of a hard disk serves requests following the shortest seek time first (SSTF) policy. 

What is the maximum cardinality of the request set, so that the head changes its direction after servicing every request if the total number of tracks are $2048$ and the head can start from any track?

  1. $9$
  2. $10$
  3. $11$
  4. $12$
edited by

16 Answers

0 votes
0 votes

As we already know from the previous answers that the difference between the sequence of requests will be like 1,3,7,15,31,63,127,511,1023,2047 and head can start from any position then we can start the zigzag line from backward i.e from 2048 to 1 (or we can do from 1 to 2048)

We can do it till the difference is 1.

So answer will be 11.

 

*As it is asked about the about cardinality of requeste set i.e the number of requests (not how many times it changed its direction) then it will be 11, as requests are 684, 681, 688, 673, 704, 641, 768, 513, 1024, 1, 2048.

*Here the head (683) is not included because head it self is not a request of the current request set.

0 votes
0 votes

QUESTION IS AMBIGUOS

Consider the request in this order by assuming header is at 1023, [1022,1024,1026,1018,1034,1002,1066,938, 1194, 682, 1706,2047,0]. 

Now think, what is the condition of SSTF algorithm? When there is a tie between the requests, in which direction should it chose? 

The above question will remove the ambiguity of the question if answered in the question.

For the above given request consider these conditions: 1) At start header move towards right or left. 2) When there is tie, header changes the direction. 

Hence the maximum number of time header changes the direction is 12, not 11.

 


ANSWER IS OPTION  - D

–2 votes
–2 votes
B...let say it starts from middle track 1024. First track would be 2^0 distance away from 1024 and next track on the opposite side 2^1 distance away from 1024 and similarly following the same pattern of zig zag motion we get the 683th track on lower end (341 distance away1024th track) and now to change its direction it has to go to the other side which means there should not be any request left on the lower end of the track. Now the last movement would be to track  number 1706th(682 away from middle track). Hence total will be  10 requests and 9 movement.
edited by
Answer:

Related questions