FCFS磁盘调度算法:
顾名思义,FCFS 调度算法按照请求到达磁盘队列的顺序来处理请求。即使更高优先级的请求稍后到达,FCFS 也会按照它们到达的顺序处理请求,因此我们可以说 FCFS 有一个公平的策略。
例子:
考虑一个有 200 个磁道 (0-199) 的磁盘,磁盘队列的 I/O 请求顺序如下: 93, 176, 42, 148, 21, 14, 180. Read\Write 的当前磁头位置head 为 55。使用 FCFS 计算 Read/Write head 的磁道移动总数。
总寻道时间,
= (93-55) + (176-93) + (176-42)
+ (148-42) + (148-21)
+ (21-14) + (180-14)
= 661
SCAN磁盘调度算法:
顾名思义,SCAN 算法以来回方式扫描磁盘的所有磁道,因此它将首先处理一个方向的所有请求,直到到达该方向的最后一个磁道,然后反转方向并开始服务其中的请求遇到了。该算法也称为电梯算法,因为它的工作原理类似于电梯,它通过在一个方向上连续移动服务请求然后反转方向。
例子:
考虑一个有 200 个磁道 (0-199) 的磁盘,磁盘队列的 I/O 请求顺序如下:93、176、42、148、21、14、180。 Read\Write 的当前磁头位置head 为 55。使用 SCAN 计算 Read/Write head 的磁道移动总数。
总寻道时间,
= (199-55) + (199-14)
= 329
现在,让我们看看 FCFS 和 SCAN 磁盘调度算法之间的区别:
Sr.No. | FCFS Disk Scheduling Algorithm | SCAN Disk Scheduling Algorithm |
---|---|---|
1. | The FCFS Scheduling Algorithm will processes requests in the sequential order in which they arrive in the disk queue. | The SCAN Scheduling Algorithm will first process the requests in one direction till it reaches the end of the disk then the disk arm reverses the direction and starts servicing the requests in it opposite order. |
2. | FCFS algorithm has a fair policy as requests processed as per schedule so there are less chances of indefinite postponement. | It may happen that the location of the request was just visited by the disk arm so the request will have a long waiting time. |
3. | FCFS algorithm gives the lowest throughput among all the disk scheduling algorithms. | SCAN algorithm has a better throughput than FCFS scheduling algorithm. |
4. | The average seek time of FCFS algorithm is the highest among all the disk scheduling algorithms as it does not try to optimize the seek time. | The average seek time of SCAN algorithm is much lower as compared to FCFS scheduling algorithm. |