140 likes | 251 Views
Disk scheduling examples. Problem parameters:. Disk has 100 cylinders, labeled 0-99. Time to move from cylinder A to cylinder B is a linear function of |A – B| Time to read a block stored at the current cylinder is the same as the time to move one cylinder. Problem statement.
E N D
Problem parameters: • Disk has 100 cylinders, labeled 0-99. • Time to move from cylinder A to cylinder B is a linear function of |A – B| • Time to read a block stored at the current cylinder is the same as the time to move one cylinder
Problem statement • Assume block requests arrive according to table to the right • Assume, at time 0, the read-write heads are positioned above cylinder 28. • Requests with identical arrival time are listed in FIFO order • Requests with arrival time of 0 are pending when the simulation begins • All times are given in cylinder movement units
FCFS • Assume, when no requests are pending, the R/W heads do not move. • What is the total time to service all requests?
FCFS • Assume, when no requests are pending, the R/W heads do not move. • What is the total time to service all requests? • (28 – 3) + 1 + (16 – 3) + 1 + (58 – 16) + 1 + (98 – 58) + 1+ (98 – 71) + 1 + (71 –12) + 1 + (56 – 12) + 1
FCFS 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 0 26 40 83 124 152
FCFS 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 212 257
Scan • Assume the R/W heads are moving towards cylinder 99 when the simulation begins • What is the total time to service all requests? (58 – 28) + 1 + (98 – 58) +1 + (99–98) + (99 – 16) + 1 + (16 – 12) + 1 + (12 – 0) + (56 – 0) + 1 + (71 – 56) + 1
Scan 0 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 31 72 [101] 157 162
Scan 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 172 231 247
SSTF • Assume the R/W heads continue moving toward cylinder 50 when there is no pending request, and that seek decisions can be changed dynamically • What is the total time to service all requests? (28 – 3) + 1 + (16 – 3) +1 + (58–16) + 1 + (98 – 58) + 1 + (98 – 71) + 1 + (71 – 38) + (56 – 38 ) + 1 + (56 – 12) + 1 = 249
SSTF 13 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 0 27 83 124 152
SSTF 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 C = 38 at 185 38 – 12 = 26 56 – 38 = 18 204 249