1. 多级队列调度(MLQ):
只有一个队列并调度所有进程是非常困难的。这是使用多级队列调度的地方。在这种情况下,进程根据进程的属性分为不同的类,例如系统进程、I/O 进程等。因此我们得到 n 类进程的“n”个队列。每个队列都有一个优先级,可以使用自己的调度算法,方便同时使用多种调度算法。通常,队列的最高级别具有最高优先级,随着我们移动到较低级别而降低。如果上层具有相对于下层的绝对优先级,则它是不可抢占的,否则,如果时间片在各个队列之间划分,则它本质上是可抢占的
- 优点 –
该算法的主要优点是我们可以在不同的队列中同时使用FCFS、SJF、LJF等多种算法。 - 缺点——
最低级别的进程遭受饥饿问题。
2. 优先级调度算法:
优先级调度算法根据进程的优先级执行进程。每个进程被分配一个优先级,优先级最高的进程首先被执行。可以在内部和外部定义优先级。内部优先级由系统根据所需资源的数量、所需时间等决定,而外部优先级基于需要工作的时间或完成工作的金额或流程的重要性。优先级调度可以是抢占式或非抢占式。
笔记 –
- 如果两个进程具有相同的优先级,则使用 FCFS 打破平局。
- 在抢占模式下,最高优先级进程的等待时间始终为零,而在非抢占模式下,它可能不为零。
缺点:
主要问题是饥饿或无限期阻塞。可能会发生在进程流中,系统一直在执行高优先级进程而低优先级进程永远不会被执行。 MLQ 和优先级调度算法的区别:
S.No. | Multi level queue scheduling (MLQ) | Priority scheduling |
---|---|---|
1. | Processes are executed depending on priority of that particular level of queue to which process belongs. Further selection of process is based upon type of algorithm used in that particular queue. | It executes processes based upon their priorities i.e. in descending order of their priorities. A process with higher priority is executed first. |
2. | It can be both non-preemptive and preemptive in nature depending upon conditions. | It is both preemptive and non preemptive in nature. |
3. | Average waiting time and average response time depends upon algorithms used in various levels of multi level queue for scheduling. | There is no idea of average waiting time and response time. |
4. | It leads to starvation of processes at lower levels of multi-level queue. | The problem of blocking of a process can be solved through aging which means to gradually increase priority of a process after a fixed interval of time by a fixed number. |
Learn all GATE CS concepts with Free Live Classes on our youtube channel.