Reputation: 63
Assume the disk head starts at track 1; there are 230 tracks (from 1 to 230); a seek takes 34 + 0.1*T milliseconds, where T is the number of tracks to move; latency is 12 milliseconds; and I/O transfer takes 3 milliseconds. Here are the requests, all in the disk queue already, and the time they arrive (starting at time 0):
arrival time(ms): 0, 21, 23, 28, 32, 45, 58, 83, 89, 109
for track: 43, 132, 34, 23, 202, 175, 219, 87, 75, 182
Compute the average time to service a request for each of the following disk scheduling algorithms: SCAN, FCFS, SSTF. Also show the order of service for each algorithm.
Answer for SCAN:
1>23>34>43>75>87>132>175>182>202>219>230
average time = 10*49 + 0.1*218 = 51.18 ms
I don't understand how they calculated the average time. The above is the only work they showed. Where did they get the 10 and 218 from in the average time formula?
Answer for FCFS
1>43>132>34>23>202>175>219>87>75>182
average time = 490 + (42+89+98+11+179+27+44+132+12+107)*0.1 = 56.4ms
I understand where they got (42+89+98+11+179+27+44+132+12+107)*0.1
from, but how did they get 490?
Upvotes: 2
Views: 2248
Reputation: 26185
For scan, the total number of tracks of movement is just the difference between 1, where the head starts, and 219, the most distant track, so time due to moving past tracks is 0.1*(219-1).
There is a seek overhead of 34, latency 12, transfer 3, total 34+12+3 = 49.
Thus the total time is 10*49+0.1*218 = 490+21.8 = 511.8, average 51.18.
The 490 ms of non-move time is the same for FCFS. Only the track move time is different.
Upvotes: 2