1. FCFS磁盘调度算法
FCFS代表“先来先服务”,此算法以它们到达磁盘队列的顺序来招待任务。它是最简单易懂的磁盘调度算法。在这种情况下,头部或指针沿任务到达的方向移动并移动,直到满足所有请求为止。但是,FCFS算法具有处理即将到来的请求的更公平的策略。与所有剩余的磁盘调度算法相比,FCFS算法的性能落后。
例子:
请考虑具有200个磁道(0-199)的磁盘和具有I / O请求的磁盘队列,其顺序如下:98、183、40、122、10、124、65。Read \ Write的当前磁头位置head为53。使用FCFS算法计算读/写磁头的磁道移动总数。
Total head movements
= (98-53)+(183-98)+(183-40)
+(122-40)+(122-10)+(124-10)+(124-65)
= 640
2. C-LOOK磁盘调度算法
C-LOOK是LOOK算法的修改版本。在这种算法中,头部从一个方向上的第一个请求开始,然后在另一端朝向最后一个请求移动,从而服务于之间的所有请求。在一端达到最后一个请求后,头部向另一个方向跳动,向其余请求移动,然后在与以前相同的方向上满足它们。 C-LOOK算法仅在一个方向上处理请求。与FCFS不同,它不按到达顺序服务请求。
例子 :
考虑一个具有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
FCFS和C-LOOK磁盘调度算法之间的区别:
S.No. | FCFS DISK SCHEDULING ALGORITHM | C-LOOK DISK SCHEDULING ALGORITHM |
1. | FCFS algorithm is easy to understand and implement. | In C-LOOK there is an overhead of finding end requestssufferthe . |
2. | In FCFS algorithm there is high variance in response time and waiting time. | In C-LOOK there is low variance in response time and waiting time. |
3. | FCFS doesn’t cause starvation to any request, but request can experience Convoy effect. | In C-LOOK algorithm neither the requests suffers starvation nor Convoy effect. |
4. | FCFS is inefficient in seek movements. | But it is very efficient in terms of seek movement in all the disk scheduling algorithms. |
5. | In the above example of FCFS, the head starts from 53 and serves the requests in the order of their arrival in disk queue. | In above example of C-LOOK algorithm, the head moves from 53, serves all requests in the right direction till it reaches the last request in one end. Then it jumps to the remaining requests and serves them in the right direction only. |
6. | In FCFS algorithm Throughput decreases. | In C-LOOK algorithm Throughput increases. |
如果您希望与行业专家一起参加现场课程,请参阅《 Geeks现场课程》和《 Geeks现场课程美国》。