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

📅  最后修改于: 2021-09-27 14:54:12             🧑  作者: Mango

1.看磁盘调度算法:
Look Algorithm 实际上是 SCAN Algorithm 的改进版本。在该算法中,磁头从磁盘一侧的第一个请求开始,并通过服务其间的所有请求而向另一端移动。到达一端的最后一个请求后,头部反转其方向并返回到第一个请求,为中间的所有请求提供服务。与 SCAN 不同,在这种情况下,头部不是走到最后一个轨道,而是走到最后一个请求,然后改变方向。

例子 –
考虑一个有 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 

2、C-LOOK磁盘调度算法:
C-LOOK 是 LOOK 和 SCAN 算法的修改版本。在该算法中,头部从一个方向的第一个请求开始,然后向另一端的最后一个请求移动,为中间的所有请求提供服务。在一端到达最后一个请求后,头部向另一个方向跳,向剩余的请求移动,然后在与之前相同的方向满足它们。与 LOOK 不同的是,它只满足一个方向的请求。

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

总的头部运动,

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

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

LOOK DISK SCHEDULING ALGORITHM C-LOOK SCHEDULING ALGORITHM
1. In LOOK, the head can serve the requests in both the directions. In C-LOOK algorithm, head can serves the requests only in one direction.
2. It lags in performance as compared to C-LOOK. C-LOOK algorithm has the best performance in all disk scheduling algorithms.
3. In above example of LOOK algorithm, the head moves from 53, serves all requests in right direction till it reaches the last request in one end. Then it reverses the direction and serves the remaining requests in left 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.
4. Here handling of request is not so good as compared to C-LOOK algorithm. C-LOOK algorithm can handle requests more effectively than LOOK.
5. LOOK has higher throughput and provides low variance response time. C-LOOK provides uniform waiting time and response time.