1.6k views

The head of a hard disk serves requests following the shortest seek time first (SSTF) policy. The head is initially positioned at track number $180$.

Which of the request sets will cause the head to change its direction after servicing every request assuming that the head does not change direction if there is a tie in SSTF and all the requests arrive before the servicing starts?

1. $11, 139, 170, 178, 181, 184, 201, 265$
2. $10, 138, 170, 178, 181, 185, 201, 265$
3. $10, 139, 169, 178, 181, 184, 201, 265$
4. $10, 138, 170, 178, 181, 185, 200, 265$

edited | 1.6k views
0
unable to understand the que???

what is actually doing in this que???? plz explain in simple way
+2
read question once again..here after "every" request means after "each" request.
0
truck number 180 :P

It should be (B).

When the head starts from $180$. It seeks the nearest track which is $181$. Then, from $181$ it seeks the nearest one which is $178$ and $184$. But the difference in both from $181$ is same and as given in the question. If there is a tie then the head wont change its direction, and therefore to change the direction we need to consider $178$. and thus we can eliminate option (A) and (C).

Coming next to option (B) and (D).

Following the above procedure you'll see that option (D) is eliminated on similar ground. And thus you can say option (B) is correct.

by Boss (19.9k points)
edited
0
whats the difference between B and D ...

in these both have 180---181---178---170---185---then remain in same direct ...?
+1
Read it clearly once :) There is differnce :D
0
B) after 185 ,201 and D) 200 then both will be in same direction then why only B)
+12

head to change its direction after servicing every request

this is the important line here

means we have to get the line zigzag manner

Here if after 185 , 200 comes direction will not change , as per question "head does not change direction if there is a tie"

but 185 to 201 head moves 185-----170-----------201 , so, it will again change its direction.

got it?

0
thanks for reply ,... but not getting exactly

how at 200 at same direction or 201 is not ... :(
+14

Draw diagram for each of the options , u will definitely get ans

see B, D I have drawn

for (D) 185 to 200 will not change direction because it is given in question " "head does not change direction if there is a tie""

but we need "head to change its direction after servicing every request "

+1
o, sorry, i did mistake, ...( i went direct 170 before 185 , 7<8 , from 178 ..  :P)

Thanks a  lot .... :)
+1
Awesome explanation:-)
0

but in option A it is also changing its directions

184->178

0
in option a)from 181 ,184 and 178 have same difference so in tie direction will not change ...