📜  SSTF和C-LOOK磁盘调度算法之间的区别

📅  最后修改于: 2021-08-25 10:28:47             🧑  作者: Mango

1. SSTF磁盘调度算法:
SSTF代表最短搜索时间优先。顾名思义,此算法为最接近头或指针当前位置的任务请求提供服务。在这里,头部的方向在确定整体头部运动中起着至关重要的作用。如果请求之间出现平局,那么头部将按照其进行中的方向处理遇到的请求。与C-LOOK不同,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. C-LOOK磁盘调度算法:
C-LOOK是LOOK和SCAN算法的修改版本。在这种算法中,头部从一个方向上的第一个请求开始,然后在另一端朝向最后一个请求移动,从而服务于两者之间的所有请求。在一端达到最后一个请求后,头部向另一个方向跳动,朝剩余的请求移动,然后在与以前相同的方向上满足它们。与SSTF不同,它不处理最接近头部或指针当前位置的任务请求。

例子 –
考虑具有200个磁道(0-199)的磁盘和具有I / O请求的磁盘队列,其顺序如下:

98, 183, 40, 122, 10, 124, 65

读/写磁头的当前磁头位置为53,它将向右移动。使用C-LOOK算法计算读/写磁头的磁道移动总数。

头部总动作

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

SSTF和C-LOOK磁盘调度算法之间的区别:

S.No. SSTF DISK SCHEDULING ALGORITHM C-LOOK DISK SCHEDULING ALGORITHM
1 SSTF algorithm can manipulate the requests in both directions. Whereas, C-LOOK algorithm services the requests only in one direction.
2 In SSTF algorithm there is an burden of finding closest request. Here, this algorithm causes more seek time as compared to SSTF.
3 SSTF algorithm lags in performance. But, the performance of C-LOOK is far better than SSTF.
4 In above example of SSTF algorithm, the head starts from 53 and analyse the request which is closest to it and hence moves in that direction. In above example of C-LOOK algorithm, the head moves from 53, serves all requests in right direction till it reaches the last request in one end. Then it jumps to the remaining requests and serve them in right direction only.
5 SSTF algorithm can leads to starvation. C-LOOK algorithm will never cause starvation to any requests.
6 SSTF provides high variance in average waiting time and response time. Whereas C-LOOK algorithm provides low variance in average waiting time and response time.