1) First come, first served (FCFS)
Start the disk drives in requester order, regardless of their physical location to access.
FCFS is the simplest scheduling algorithm based on the order in which the process requests to access the disk. The advantage of this algorithm is that it is fair. Better performance is expected if only a small number of processes need to access, and most requests are to access clustered file sectors. But if a large number of processes are competing for disk, the algorithm tends to approach random scheduling in performance. Therefore, some more complex scheduling algorithms are considered in actual disk scheduling.
1. Algorithm idea: service according to the order of arrival of access requests.
2. Advantages: Simple and fair.
3. Disadvantages: low efficiency. Two adjacent requests may lead to the innermost to the outermost cylinder seeking, which makes the magnetic head move repeatedly and increases the service time, which is also unfavorable to the machine.
2) Shortest seek time priority (SSTF)
The track selected by SSTF algorithm for scheduling processing is the track with the closest distance to the track where the current magnetic head is located, so as to minimize the search time for each time. Of course, always choosing the minimum search time does not guarantee the average search time, but it does provide better performance than the FCFS algorithm. This algorithm creates hunger.
1. Algorithm idea: Priority is given to the access request nearest to the current head for service, mainly considering seek priority.
2. Advantages: Improved average disk service time.
3. Disadvantages: It causes some access requests to wait for a long time without service, that is, the phenomenon of "hunger" occurs.
3) SCAN algorithm or elevator scheduling algorithm
The SCAN algorithm selects the request closest to the current head track in the current head movement direction as the object to be served next time. Because the law of magnetic head movement is similar to the operation of elevator, it is also called elevator scheduling algorithm. The SCAN algorithm is unfair to recently scanned regions and, therefore, it is not as good at accessing locality as FCFS or SSTF algorithms.
Algorithm idea: When the device has no access request, the head does not move; When there is an access request, the magnetic head moves in one direction. During the process of moving, it serves the access request it encounters. Then it judges whether there is still an access request in that direction. Otherwise change the direction of movement and service for passing access requests, and so on.
Scanning algorithm (elevator algorithm) magnetic head movement trajectory
Advantages: it overcomes the disadvantage of shortest seek first, considering both distance and direction
Disadvantages: There is a problem with a request just being missed and having to wait a long time.
4) Cyclic Scanning Algorithm (CSCAN)
Circular scanning scheduling algorithm is on the basis of the scanning algorithm improvement, in order to reduce delay, head one-way movement, for example, just move from inside to outside, starting from the current position along the direction of the movement of the head to choose is closest to the current head of the cylinder to access, if no request, along the direction of the magnetic head head immediately return to the most inside to visit cylinder, and also the smallest cylinder number followed by the largest cylinder number constitute a cycle.
Advantages: Better seek performance and hunger prevention, while reducing the maximum time a request can wait.
Disadvantages: It is possible for the head to stay fixed (magnetic arms stick)
example:
