📜  SSTF和LOOK磁盘调度算法的区别

📅  最后修改于: 2021-09-27 22:47:32             🧑  作者: Mango

1. SSTF磁盘调度算法:
SSTF 代表最短寻道时间优先。顾名思义,该算法服务于最接近当前头部或指针位置的任务请求。在这里,头部的方向在确定整个头部运动中起着至关重要的作用。如果请求之间出现联系,则头部将在其正在进行的方向上为遇到它的请求提供服务。

例子 –
考虑一个有 200 个磁道 (0-199) 的磁盘,磁盘队列的 I/O 请求顺序如下: 98, 183, 40, 122, 10, 124, 65. Read\Write 的当前磁头位置head 是 53 并且会朝正确的方向移动。使用SSTF算法计算读/写磁头的磁道移动总数。

总的头部运动,

= (65-53)+(65-40)+(40-10)+(98-10)
              +(122-98)+(124-122)+(183-124)
= 240 

2.看磁盘调度算法:
Look Algorithm 实际上是 SCAN Algorithm 的改进版本。在这个算法中,磁头从磁盘的一侧开始第一个请求,并通过服务其间的所有请求向另一端移动。与 SCAN 不同,在这种情况下,头部不是走到最后一个轨道,而是走到最后一个请求,然后改变方向。与 SSTF 不同,它不处理最接近当前头部或指针位置的任务请求。

例子 –
考虑一个有 200 个磁道 (0-199) 的磁盘,磁盘队列的 I/O 请求顺序如下: 98, 183, 40, 122, 10, 124, 65. Read\Write 的当前磁头位置head 是 53 并且会向右移动。使用LOOK算法计算读/写磁头的磁道移动总数。

总的头部运动,

= (65-53)+(98-65)+(122-98)
              +(124-122)+(183-124)+(183-40)+(40-10)
= 303 

SSTF和LOOK磁盘调度算法的区别:

LOOK SCHEDULING ALGORITHM SSTF SCHEDULING ALGORITHM
1. The performance of LOOK is better than SSTF. SSTF lags in performance.
2. LOOK results in increased total seek time. It reduces total seek time as compared to LOOK.
3. It provides low variance in average waiting time and response time. This algorithm provides high variance average response time and waiting time.
4. As shown in above example, direction of head gets reversed when it serves the last request in one direction. But here, direction of head plays an important role, in order to break tie between requests.
5. In this algorithm, there is an overhead for finding end request. Here, there is an overhead for finding out closest request.
6. LOOK does not cause starvation to any request. Here, the request which are far from head will suffer starvation.
7. LOOK algorithm can handle requests more effectively than SSTF. Here handling of request is not so good as compared to LOOK algorithm.