C-LOOK磁盘调度算法
C-LOOK是LOOK和C-scan算法的修改版本。在此算法中,头部从一个方向上的第一个请求开始,然后在另一端朝向最后一个请求移动,从而服务于之间的所有请求。在一端达到最后一个请求后,头部向另一个方向跳动,向其余请求移动,然后在与以前相同的方向上满足它们。与C-SCAN不同,头指针将一直移动到磁盘结束请求为止。
例子 :
考虑具有200个磁道(0-199)的磁盘和具有I / O请求的磁盘队列,其顺序如下:
98, 183, 40, 122, 10, 124, 65
读/写磁头的当前磁头位置为53,它将向右移动。使用C-LOOK算法计算读/写磁头的磁道移动总数。
Total head movements
= (65 - 53) + (98 - 65)
+ (122 - 98)
+ (124 - 122) + (183 - 124)
+ (183 - 10) + (40 - 10)
= 333
C-SCAN磁盘调度算法
C扫描算法(也称为循环电梯算法)是SCAN算法的修改版本。在这种算法中,头指针从磁盘的一端开始,然后向另一端移动,以服务于这两者之间的所有请求。到达另一端后,头部反转其方向并转到起点。然后,它会按照与以前相同的方向满足其余请求。与C-LOOK不同,无论是否有请求,头指针都将移动到磁盘末端。
例子 –
考虑具有200个磁道(0-199)的磁盘和具有I / O请求的磁盘队列,其顺序如下:
98, 183, 40, 122, 10, 124, 65
读/写磁头的当前磁头位置为53,它将向右移动。使用C扫描算法计算读/写磁头的磁道移动总数。
Total head movements
= (65 - 53) + (98 - 65)
+ (122 - 98)
+ (124 - 122) + (183 - 124)
+ (199 - 183) + (199 - 0)
+ (10 - 0) + (40 - 10)
= 395
C-LOOK和C-SCAN磁盘调度算法之间的区别
C-LOOK | C-SCAN | |
---|---|---|
1 | C-LOOK algorithm has the best performance in all disk scheduling algorithms. | Whereas C-SCAN lags in performance, when compared to C-LOOK |
2 | C-LOOK algorithm can handle requests more effectively than C-SCAN. | Here handling of request is not so good as compared to C-LOOK algorithm. |
3 | 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. | In above example of C-SCAN algorithm, the head moves from 53, serves all requests in right direction till it reaches the other end. Then it jumps to opposite end and serve remaining requests in right direction only. |
4 | C-LOOK provides low variance in response time and waiting time. | C-SCAN provides uniform waiting time and response time. |
5 | In C-LOOK algorithm, there is an overhead of finding the end requests. | C-SCAN algorithm causes more seek time as compared to C-LOOK. |
如果您希望与行业专家一起参加现场课程,请参阅《 Geeks现场课程》和《 Geeks现场课程美国》。