1. 多级队列调度(MLQ):
只有一个队列并调度所有进程是相当困难的。这是使用多级队列调度的地方。在这种情况下,根据进程的属性(例如系统进程、I/O 进程等)将进程分为不同的类。因此我们得到 n 类进程的“n”个队列。每个队列都有一个优先级,可以使用自己的调度算法,方便同时使用多种调度算法。通常,队列的最高级别具有最高优先级,随着我们移动到较低级别而降低。如果上层具有相对于下层的绝对优先级,则它是不可抢占的,否则,如果时间片在各个队列之间划分,则它本质上是可抢占的。
- 优点 :
该算法的主要优点是我们可以在不同的队列中同时使用FCFS、SSJF、LJF等多种算法。 - 缺点:
最低级别的进程遭受饥饿问题。
2. 先到先得 (FCFS) 调度算法:
它是最简单的非抢占式调度算法。在先来先服务 (FCFS) 中,进程按照它们到达的顺序分配给 CPU。队列数据结构用于实现FCFS调度算法。当 CPU 空闲时,位于就绪队列头部的进程被分配给 CPU。然后从队列中删除正在运行的进程。当一个新进程进入就绪队列时,它被放到就绪队列的尾部。
FCFS 和多级队列调度的区别:
First Come First Served (FCFS) | Multi Level Queue Scheduling |
---|---|
First Come First Served (FCFS) is the non-preemptive scheduling algorithm. | MLQ can be non-preemptive or preemptive depending on the conditions. |
It executes the processes in ascending order of their arrival time. | Processes are executed depending on the priority of that particular level of queue to which the process belongs. Further selection of process is based upon the type of algorithm used in that particular queue. |
FCFS has the minimal overhead. | MLQ has some CPU overhead as it needs to switch between the queues. |
First Come First Served Scheduling Algorithm provides high response time for the processes. | Response time may be high or low depending upon the algorithms used in various levels of the multi level queue. |
FCFS is inconvenient to use in the time sharing system. | It can be implemented in any system depending upon the need. |
Average waiting time is generally not minimal in First Come First Served Scheduling Algorithm. | Average waiting time depends upon the algorithms used in various levels of queues. |
It is the simplest type of algorithm. | It is complex algorithm and is difficult to implement. |
It leads to convoy effect. | It leads to the starvation of processes at lower levels. |