Disk Scheduling
• The operating system is responsible for using hardware efficiently — for
the disk drives, this means having a fast access time and disk bandwidth.
• Access time has two major components
–
Seek time
is the time for the disk arm to move the heads to the
cylinder containing the desired sector.
–
Rotational latency
is the additional time waiting for the disk to rotate
the desired sector to the disk head.
Disk Scheduling (Cont.) FCFS
• Several algorithms exist to schedule the servicing of
disk I/O requests.
• FCFS is the simplest form of disk scheduling.
• Does not provide the fastest service.
• We illustrate them with a request queue (0-199).
98, 183, 37, 122, 14, 124, 65, 67
FCFS
SSTF
• It seems reasonable to service all the requests close to the
current head position , before moving the head far away to
service other requests.
• SSTF Selects the request with the minimum seek time
from the current head position.
• SSTF scheduling is a form of SJF scheduling; may cause
starvation of some requests as requests may arrive at any
time.
SCAN
• The disk arm starts at one end of the disk, and moves
toward the other end, servicing requests until it gets to the
other end of the disk, where the head movement is
reversed and servicing continues.
• Sometimes called the
elevator algorithm
.
• If a request arrives in the queue just in front of the head, it
will be serviced immediately; a request arriving just
behind the head will have to wait until arm moves to the
end of the disk, reverse direction and comes back.
C-SCAN
• Provides a more uniform wait time than SCAN.
• The head moves from one end of the disk to the other.
servicing requests as it goes. When it reaches the
other end, however, it immediately returns to the
beginning of the disk, without servicing any requests
on the return trip.
C-LOOK
• Version of C-SCAN
• Arm only goes as far as the last request in
each direction, then reverses direction
FCFS
Given the following queue -- 95, 180, 34, 119, 11, 123, 62, 64 with the Read-write
head initially at the track 50 and the tail track being at 199 let us now discuss the
FCFS
In this case request is serviced according to next shortest distance. Starting at 50, the next shortest distance would be 62 instead of 34 since it is only 12 tracks away from 62 and 16 tracks away from 34. The process would continue until all the process are taken care of. For example the next case would be to move from 62 to 64 instead of 34 since there are only 2 tracks between them and not 18 if it were to go the other way. Although this seems to be a better service being that it moved a total of 236 tracks, this is not an optimal one. There is a great chance that starvation would take place. The reason for this is if there were a lot of requests close to eachother the other requests will never be handled since the distance will always be greater.