2.3k views
Suppose a disk has $201$ cylinders, numbered from $0$ to $200$. At some time the disk arm is at cylinder $100$, and there is a queue of disk access requests for cylinders $30, 85, 90, 100, 105, 110, 135$ and $145$. If Shortest-Seek Time First (SSTF) is being used for scheduling the disk access, the request for cylinder $90$ is serviced after servicing ____________ number of requests.
edited | 2.3k views

Requests are serviced in following order

$100 \ 105 \ 110 \ 90 \ 85 \ 135 \ 145 \ 30$

So, request of $90$ is serviced after $3$ requests.
edited
+1
how can we say that it will move in +ve direction first?
+5
105 os near to 100 so it will move in right direction
+2
if u not move in +ve direction then u will not get small seek time. try it.

by taking -ve side .
+1
thanks. right. i just missed it. equidistant.
+8
shouldnt the answer be 2? because it is already present at 100 :(
+14
@resilentknight ..even head is at 100 but need to service it or not?? 3 is rt..

if question about seek than 2 will be ans..
0
yes @Gabbar
0
why 3 and why not 4.

It will serve request at 100 ,105 110 and 135 , so it may be placed at 100 but it needs rotational latency of at  100 also .so shouldn't we consider 4.
0
I have a doubt, not wrt this question but in general about SSTF algorithm

At any time say if R/W head is on cylinder 110 and two upcoming requests are for cylinders 135 and 85, then on which cylinder it will move first, 135 or 85 since both are at same distance of 25 ?
0

if question about seek than 2 will be ans..

how?

+3
@set2018 Seek time is time to move head.  So before 90,  2 seeks are there 100 to 105 and 105 to 110.

I have one confusion if 100 is not in the request sequence, but head at 100 so the requests serviced before 90 are 2 (105,110)

Is my assumption  true?
+1

gari  request served will be 3 before 90 that is 100,105,110

becoz in question it is clearly mention that disk head oint to 100.that means starting point is already given now from tht point (including 100)we served next request thts why 3 request served before 90

+2
Yes totally agree with that... But I am asking that suppose disk arm is at 100,

But in request sequence  there is no 100 ie 30,85,90,105,110, 135,145....in this case as head at 100 but no request for it... So request for 90 is serviced after servicing 105 and 110.
0
i think if 100 is not mention then also we have to served that request ,becoz for seek time calculation we also include this .
0
For Eg request  51 52

Head at 50. So seek will be for 51 and 52.

Request at 50 is already fulfilled and head is waiting for next request.

So yes 50 is included in seek time calculation but it's request is already fulfilled.

0
@anchit

It depends on the implementation , in general, head will not change its direction, if it has two equidistant blocks, it will chose the one which comes in its current direction.
0
@papesh

seek time will also be 3 ..?
3 requests..
+1 vote
In Shortest-Seek-First algorithm, request closest to the current position of the disk arm and head is handled first. In this question, the arm is currently at cylinder number 100. Now the requests come in the queue order for cylinder numbers 30, 85, 90, 100, 105, 110, 135 and 145. The disk will service that request first whose cylinder number is closest to its arm. Hence 1st serviced request is for cylinder no 100 ( as the arm is itself pointing to it ), then 105, then 110, and then the arm comes to service request for cylinder 90. Hence before servicing request for cylinder 90, the disk would had serviced 3 requests. Hence option C.
+1 vote
You might think that service requests are 2 but it is wrong why?

You must include service request 100 also.
( 100,105,110 then 90 service request will be taken. )
0
If 100 was not given as service as request (i.e only head is present here)then the answer would have been 2?

1
2
3
4
5
6