The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+22 votes
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.
asked in Operating System by Veteran (96.1k points)
edited by | 2.3k views

4 Answers

+24 votes
Best answer
Requests are serviced in following order

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

So, request of $90$ is serviced after $3$ requests.
answered by Boss (30.9k points)
edited by
how can we say that it will move in +ve direction first?
105 os near to 100 so it will move in right direction
if u not move in +ve direction then u will not get small seek time. try it.

by taking -ve side .
thanks. right. i just missed it. equidistant.
shouldnt the answer be 2? because it is already present at 100 :(
@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..
yes @Gabbar
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.
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 ?


if question about seek than 2 will be ans..


@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?

 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

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, this case as head at 100 but no request for it... So request for 90 is serviced after servicing 105 and 110.
i think if 100 is not mention then also we have to served that request ,becoz for seek time calculation we also include this .
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.

Is my logic OK? Please help

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.

seek time will also be 3 ..?
+3 votes
3 requests..
answered by (339 points)
+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.
answered by Loyal (9.3k points)
+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. )
So Answer is 3
answered by (331 points)
If 100 was not given as service as request (i.e only head is present here)then the answer would have been 2?

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,540 questions
54,099 answers
71,007 users