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. |