6,674 views

Consider a disk with the $100$ tracks numbered from $0$ to $99$ rotating at $3000$ rpm. The number of sectors per track is $100$ and the time to move the head between two successive tracks is $0.2$ millisecond.

1. Consider a set of disk requests to read data from tracks $32, 7, 45, 5$ and $10$. Assuming that the elevator algorithm is used to schedule disk requests, and the head is initially at track $25$ moving up (towards larger track numbers), what is the total seek time for servicing the requests?
2. Consider an initial set of $100$ arbitrary disk requests and assume that no new disk requests arrive while servicing these requests. If the head is initially at track $0$ and the elevator algorithm is used to schedule disk requests, what is the worse case time to complete all the requests?

why we are not trvl only given track

like 25 -- 32--45--99--10--7--5

@mohan123

We are moving on all the given tracks:

$25\overset{7}{\rightarrow}32\overset{13}{\rightarrow}45\overset{54}{\rightarrow}99\overset{89}{\rightarrow}10\overset{3}{\rightarrow}7\overset{2}{\rightarrow}5=168$

We are using SCAN - Elevator algorithms.

We will need to go from $25\rightarrow 99 \rightarrow 5$. (As we will move up all the way to $99$,servicing all request, then come back to $5$.)

So, total seeks $= 74+94= 168$

Total time $= 168 \times 0.2 = 33.60000$

We need to consider rotational latency too $\rightarrow$

$3000$ rpm

I.e. $50$ rps

$1 \ r = 1000 /50 \ msec = 20 \ msec$

So, rotational latency $= 20/2 = 10 \ msec$ per access.

In worst case we need to go from tracks $0-99.$ I.e. $99$ seeks

Total time $= 99 \times 0.2 + 10 \times 100 = 1019.8 \ msec = 1.019 \ sec$

edited by

what is the worse case time to complete all the requests?

Hi Guys,

I think instead of average rotational latency we should take time taken in full rotation. What is your opinion ?

edited by
If we are taking rotational latency because of "we do not know which sector is to be selected in those 100 random track request", then also in part - a) if request completion time asked instead of "seek time" then we have to consider the same avg. rotational latency in addition?
@bruv depends on question
One thing to notice here

request should go from 25 ->99 ->10

isnot it?

why upto 5 track request is taking?

Is there calculation mistake or am I missing somewhere?

Plz chk

@srestha ji,

Is there calculation mistake

No

am I missing somewhere?

Yes

@srestha

25 ->99 ->5 .Means staring from 25 goto 99 and service all request and come back to 5 ans service all request on the way.
In the worst case, can the requests come in the form - 0, 99, 0, 99 .... so on. In that case for every two requests 99 seek would be needed. Correct me If I am wrong here...
Why 99 seeks ?

In worst case

Request can be from tracks

0, 99, 1, 98,...

Plz clarify.
because it is elevator algortihm dude..it wont follow the order of requests...it goes in a flow...till end and come back
NO not at all
edited

Servicing a request means reading a particular sector or reading whole track?

edited by

If requests like - 0, 1, 2, ----, 99 (100 requests)

Let head is at track number 1 and given that head is moving towards larger track number.

then in worst case, total seek = 98 + 99 =  197

So why it is 99?

-------------------------------------------------------------------------

P.S - sorry, I missed it

If the head is initially at track 0

In case of (b)

(Assume sectors are numbered from 0 to 99)

when we consider rotational delay,(assume R-W head in track 0 is at sector 0)

Consider like in Track no. 0 we have to read 99th sector.Then from 0th to 99th sector we have to move head.It means 99*0.2 ms

In Track no. 1 assume we have to read 0th sector.Now we have to move head to 0 from 99th sector.So again 99*0.2 ms.

And so on......................................(this pattern alternates for all 100 tracks)

So finally worst case Rotational delay will be 99*0.2 ms for each track.

I think this type of access pattern would be worst case as it is taking more movements.

So if we consider worst case time = 99*(0.2 ms + R)  = 99( 0.2 ms +99*0.2 ms) =1980 ms =1.980 sec

Anyone please clarify whether this is correct or not.

We need not consider sector number. And multiplying sector number with rotational latency will not give us the worst case rotational delay. (I meant the one highlighted here 99( 0.2 ms +99*0.2 ms))

The question does not specify the track number, so we take average rotational delay = R/2.

We have 99 seeks (for tracks from 0 to 99), seek time = 99 * 0.2 ms = 19.8 ms = 0.0198 s

Each of the 100 track requests (0 to 99) will have some rotational delay. We take average rotational delay here as we are not provided with the information about the sectors.

Rotational delay = 100 * R/2 = 100 * 10 ms = 1 s

Total delay in servicing all 100 requests = 0.0198 s + 1 s = 1.0198 s

You can actually argue and take full rotational delay(=R) instead of average(=R/2), because in the worst case we will have to rotate the disk completely for each track request. In that case the answer would be 2.0198s. (There is a lot of discussion about this in the previous comments. I am not sure what to consider. If asked in exam my answer would be 2.0198s :P)

why we are eliminating transfer time,is it because nothing mentioned about which or how many sector to read ???

I think it should be 19.8 + (100*10) + (100*0.2)

0.2 ms is the transfer time for 1 sector.

@Akash Servicing a request means going to a particular surface,cylinder,track and sector right? Hence we are considering avg. rotational latency in (b)?

I was having doubt why rotational latency is considered in 2nd part. Is it because 2nd part asks for worst case time and 1st part just asks for seek time ?

For everyone who are wondering worst case scenario 0,99,1,98,2,97,….49,50  then before accessing the other requests from the current head you sort the list and go to only specified direction before revsersing head i.e it is given we should move towards higher side in this question ...since 0 to 99 all are consecutive we requre just 99 seeks and when head reverses no requests are pending..Hope it helps you

@arjun sir can you tell me , why rotational time is being taken in this , bcoz in 1st part only seek time taken???

CAN you tell me why rotational time not taken in 1st question???

a)

5,7,10,32,45

end track: 99

current:25

total seeks=(99-25)+(99-5)=74+94=168

total seek time = 0.2 * 168 ms

b)

from 0 to 99

worst case time = 0.2 * 99 ms
by

### 1 comment

You missed rotational latency
B.

Question is about how much time required to satisfied 100  requests...

1 request time is = Tseek +TrotLatency + data transfer time

Datatransfer time = 0(as not given any info)

99 seeks and 100 rotations required in worst case...

So 99 * seek time + 100*rotational latency...