📜  FCFS和C-SCAN磁盘调度算法之间的区别

📅  最后修改于: 2021-07-05 06:13:24             🧑  作者: Mango

1. FCFS磁盘调度算法:
FCFS代表先到先服务,此算法以它们到达磁盘队列的顺序来招待任务。它是最简单易懂的磁盘调度算法。在这种情况下,头部或指针沿任务到达的方向移动并移动,直到满足所有请求为止。但是,FCFS算法具有处理即将到来的请求的更公平的策略。

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

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

Read \ Write磁头的当前磁头位置为53。使用FCFS算法计算Read / Write磁头的磁道移动总数。

头部总动作

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

2. C-SCAN磁盘调度算法:
C-SCAN算法,也称为循环电梯算法,是SCAN算法的修改版本。在这种算法中,头指针从磁盘的一端开始,然后向另一端移动,以服务于这两者之间的所有请求。到达另一端后,头部反转其方向并转到起点。然后,它会按照与以前相同的方向满足其余请求。 C-SCAN是最好的磁盘调度算法之一。

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

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

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

头部总动作

= (65-53)+(98-65)+(122-98)+(124-122)+(183-124)
               +(199-183)+(199-0)+(10-0)+(40-10)
= 395

FCFS和C-SCAN磁盘调度算法之间的区别:

S.No. FCFS DISK SCHEDULING ALGORITHM C-SCAN DISK SCHEDULING ALGORITHM
1 FCFS is inefficient in seek movements. Whereas C-SCAN is very efficient in seek movements.
2 FCFS cause more average waiting time and response time. But C-SCAN cause less average response time and waiting time.
3 In above example of FCFS, the head starts from 53 and serves the requests in the order of their arrival in disk queue. In the 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 the opposite end and serves remaining requests in right direction only.
4 In FCFS algorithm there is decrement in Throughput. Here there is increment in Throughput.
5 FCFS doesn’t cause starvation to any request, but request can experience Convoy effect. In C-SCAN algorithm neither the requests suffers starvation nor Convoy effect.
6 FCFS algorithm is easy to understand and implement. The performance of C-SCAN algorithm is far better than FCFS algorithm.