操作系統磁盤調度
磁盤調度 (Disk Scheduling)
One of the major duties of the operating is that, to use the hardware orderly and accurately. For disk drives, it has a duty of having a fast access time and disk bandwidth. Generally, bandwidth is the total number of bytes, which need to be transferred, and then divided by the total time between the first service and the last transfer. In the case of disk structure, we have to improve both access time and the bandwidth with the help of scheduling the service of disk I/O requests in good order. By this there are many techniques comes for disk scheduling which is prescribed below.
操作的主要職責之一是有序,準確地使用硬件。 對于磁盤驅動器,它具有快速訪問時間和磁盤帶寬的職責。 通常,帶寬是需要傳輸的總字節數,然后除以第一次服務和最后一次傳輸之間的總時間。 在磁盤結構的情況下,我們必須通過合理安排磁盤I / O請求的服務來改善訪問時間和帶寬。 通過這種方式,有許多用于磁盤調度的技術,如下所述。
1. FCFS調度 (1. FCFS Scheduling)
This is a simple scheduling algorithm which means first come first serve form of an algorithm. This kind of algorithm generally not provides the fastest service.
這是一種簡單的調度算法,這意味著算法的先到先得形式。 這種算法通常不會提供最快的服務。
Consider the example: a disk queue with a request for I/O to blocks on cylinder 97, 182, 37, 128, and 15 in that order. If the disk head is initially at cylinder 52, so it will first move from 52 to 97, then 182, 37, 128, 15. There is a drastic change in the moment like 37 to 128 and then back to 15, it can generate the problem with this schedule.
請考慮以下示例:一個磁盤隊列,該請求按順序依次請求柱面97、182、37、128和15上的塊的I / O。 如果磁盤頭最初位于圓柱體52上,那么它將首先從52移至97,然后從182、37、128、15移動。此刻會發生劇烈變化,例如從37變為128,然后又回到15,則可以生成這個時間表的問題。
2. SSTF調度 (2. SSTF scheduling)
This is an algorithm which is termed as shortest seek time first algorithm. This type of algorithm selects the request with the minimum seek time from the current head position, as seek time is a time in which the arm has to move the head to the cylinder containing the desired sector. Seek time will be increased if the number of the head will be traversed by the head, as SSTF choose the request closest to the head position.
這是被稱為最短尋道時間優先算法的算法。 這種類型的算法從當前磁頭位置中選擇具有最小尋道時間的請求,因為尋道時間是手臂必須將磁頭移動到包含所需扇區的圓柱的時間。 如果SSTF選擇最接近磁頭位置的請求,那么如果磁頭遍歷磁頭的數量,則搜索時間將會增加。
3.掃描計劃 (3. SCAN Scheduling)
SCAN scheduling algorithm is also called the elevator algorithm because in such kind of algorithm arm behaves just like an elevator for building the way. In the SCAN algorithm, the arm will start at the one end of the disk and then move towards another end of the disk. At the last end, the head of the arm will be reversed and then this process continues.
SCAN調度算法也稱為電梯算法,因為在這種算法中,手臂的行為就像電梯一樣。 在SCAN算法中,機械臂將從磁盤的一端開始,然后朝磁盤的另一端移動。 最后,手臂的頭部將反轉,然后繼續此過程。
4. C-SCAN調度 (4. C-SCAN Scheduling)
This kind of algorithm is termed as circular scan scheduling algorithm. This is designed to provide a uniform wait time. The C-SCAN algorithm treats the cylinder as the circular lists which will wrap the final cylinder to the first one. Although it is same as SCAN, in this also the head will move from one end to the another, when the head reaches the end it immediately return at a position of the beginning of the disk, without any request.
這種算法稱為循環掃描調度算法。 這旨在提供統一的等待時間。 C-SCAN算法將圓柱體視為循環列表,它將最終圓柱體包裝到第一個圓柱體中。 盡管與SCAN相同,但磁頭也將從一端移動到另一端,當磁頭到達一端時,它會立即返回磁盤起始位置,而無需任何請求。
5.查找計劃 (5. LOOK scheduling)
This is the same as a SCAN algorithm, this algorithm kindly check the LOOKS to see whether there is any request which is pending in the direction of a head moment. Generally, according to the LOOK algorithm, the arm goes only as far as possible in each direction and then reverse direction without going to the end. The variant like scan is called LOOK scheduling because at last, they will look for a request before to move in a given direction.
這與SCAN算法相同,該算法請檢查LOOKS,以查看是否有任何在頭部力矩方向上待處理的請求。 通常,根據LOOK算法,機械臂只會在各個方向上盡可能遠地移動,然后在不移動的情況下反向移動。 像scan這樣的變量稱為LOOK調度,因為最后,它們將在向給定方向移動之前先查找請求。
Selection of a Disk-Scheduling Algorithms
磁盤調度算法的選擇
SSTF is a common algorithm which will increase the performance over the FCFS. SCAN and C-SCAN perform better for the system which places a heavy load on the disk because there is no such kind of a starvation problem. For any kind of the algorithm, the performance is basically dependent upon the number and the type of the requests. Disk scheduling algorithm should be written separately so that it can be replaced by a different algorithm if necessary. In this case, SSTF or LOOK is the best choice for the shortcoming algorithm.
SSTF是一種通用算法,它將提高FCFS的性能。 SCAN和C-SCAN在磁盤上負載較重的系統上表現更好,因為不存在此類饑餓問題。 對于任何一種算法,性能基本上都取決于請求的數量和類型。 磁盤調度算法應單獨編寫,以便在必要時可以用其他算法替換。 在這種情況下,SSTF或LOOK是該缺點算法的最佳選擇。
翻譯自: https://www.includehelp.com/operating-systems/disk-scheduling.aspx
操作系統磁盤調度