Disk Scheduling algorithm

Source: Internet
Author: User

Disk Scheduling algorithm

The disk is scheduled to meet the requests of each process for read/write operations to the disk. Because sometimes these processes send requests faster than disk response, it is necessary for each disk device to establish a waiting queue, the common disk scheduling algorithm has the following four kinds:

First come first service algorithm ( FCFS )

Scheduling based on the order in which the process requests access to the disk;

shortest seek time first algorithm ( SSTF )

Closest disk-first access based on the track selected to access and the tracks where the current head is located

Scanning Algorithm ( SCAN )

In a current position, follow the priority direction of movement (for example, from the inside out) to find a track that is closer to the current position priority scheduling, until there is no track in that direction to be accessed before the magnetic arm reversing (moving from the outside), similar to elevator scheduling.

cyclic scanning algorithm ( Cscan )

The cyclic scanning algorithm specifies that the head one-way movement, in a certain current position, according to the specified unidirectional direction of movement (for example, from the inside out) to find a track closer to the current position priority scheduling, until there is no track in that direction, the head immediately back to the most track for access.

Example: Assume that a disk has 200 cylinders, numbered 0-199, if the service is currently being requested for access to the 125th cylinder, after the requestor serving the 143th cylinder, there are several requesters waiting for the service, each of which has to access the cylinder number 86,147,91,177,94,150 , 102,175,130

1 ), first-come-first service algorithm ( FCFS ) First Come first Service

It is dispatched according to the order in which the process requests access to the disk. The advantages of this algorithm are fair and simple, and each process request can be processed in turn, and there will be no long-term unmet request for a process. Because the algorithm does not optimize the seek path, the algorithm will reduce the throughput of the equipment service, and the average seek time may be longer, but the response time of each process is less than that of the access request of the disk.

First come first served (125) 86.147.91.177.94.150.102.175.130

2 ), shortest seek time first algorithm ( SSTF ) Shortest Seek time first

The algorithm chooses such a process, which requires access to the track with the current head of the track distance nearest, so that the shortest time to seek, the algorithm can get better throughput, but can not guarantee the shortest average seek time. The disadvantage is that the response time to the user's service request is not equal, resulting in a significant change in response times. In the case of many service requests, requests for internal and external edge tracks will be delayed indefinitely, and some requests will not be expected to respond.

Shortest seek time First (125) 130.147.150.175.177.102.94.91.86

3 ), Scanning algorithm ( SCAN ) Elevator Scheduling

The scanning algorithm takes into account not only the distance between the track to be accessed and the current track, but also the current direction of movement of the head. For example, when the head is moving from inside out, the next Access object selected by the scanning algorithm should be the track it wants to access, both outside the current track and closest to the distance. In this way from the field visits, until there is no more outside the track need to access the magnetic arm reversing, from the outward movement. At this time, it is also a process to choose such a schedule, that is, the track to be accessed, in the current track, so as to avoid the emergence of hunger phenomenon. Because the law of the head movement in this algorithm is quite like the operation of elevator, it is also called elevator scheduling algorithm. This algorithm basically overcomes the disadvantage that the service of the shortest seek time first algorithm concentrates on the change of intermediate track and response time, while the advantage of the shortest seek time first algorithm is that the throughput is large, the average response time is small, but because of the swing scanning method, the track of both sides is still lower than the intermediate track.

Elevator dispatching (125) 102.94.91.86.130.147.150.175.177

4 ), cyclic scanning algorithm ( Cscan )

The cyclic scanning algorithm is an improvement to the scanning algorithm. If the access request to the track is evenly distributed, there is a relatively small number of access requests that fall behind the head when the head reaches one end of the disk and moves backwards. This is due to the fact that these tracks have just been processed and the request density on the other side of the disk is quite high, and these access requests wait longer, in order to resolve this situation, the cyclic scanning algorithm specifies one-way head movement. For example, only moving from the inside out, when the head is moved to the most visited track, the head immediately returns to the top of the desired track, the smallest track number followed by the maximum track number to form a cycle, to scan.

Circular Scan (125) 130.147.150.175.177.86.91.94.102

Disk Scheduling algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.