1. SSTF磁盘调度算法:
SSTF代表最短搜索时间优先。顾名思义,该算法为最接近头部或指针当前位置的任务请求提供服务。在这里,头部的方向在确定整体头部运动中起着至关重要的作用。如果请求之间出现平局,那么头部将按照其进行中的方向处理遇到的请求。
例子 –
请考虑具有200个磁道(0-199)的磁盘和具有I / O请求的磁盘队列,其顺序如下:98、183、40、122、10、124、65。Read \ Write的当前磁头位置头是53,并且将向右移动。使用SSTF算法计算读/写磁头的磁道移动总数。
头部总动作
= (65-53)+(65-40)+(40-10)+(98-10)
+(122-98)+(124-122)+(183-124)
= 240
2. LOOK磁盘调度算法:
外观算法实际上是SCAN算法的改进版本。在这种算法中,磁头从磁盘的一侧开始第一个请求,并通过为磁盘之间的所有请求提供服务而朝另一端移动。与SCAN不同,在这种情况下,磁头不是一直走到最后一个轨道,而是一直走到最后一个请求,然后改变方向。与SSTF不同,它不处理最接近头部或指针当前位置的任务请求。
例子 –
请考虑具有200个磁道(0-199)的磁盘和具有I / O请求的磁盘队列,其顺序如下:98、183、40、122、10、124、65。Read \ Write的当前磁头位置头是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. |