📌  相关文章
📜  多级队列调度(MLQ)与最短作业优先之间的区别

📅  最后修改于: 2021-08-27 07:06:47             🧑  作者: Mango

1.多级队列调度(MLQ):
仅拥有一个队列并安排所有进程是非常困难的。这是使用多级队列调度的地方。在此过程中,根据进程的属性(例如系统进程,I / O进程等)将进程分为各种类别。因此,对于n类进程,我们获得了“ n”个队列。每个队列都分配了一个优先级,并且可以使用自己的调度算法,这使得同时使用多个调度算法变得很方便。通常,最高级别的队列具有最高优先级,随着我们移至较低级别,该优先级会降低。如果较高级别的绝对优先级高于较低级别的优先级,则它是不可抢占的,否则,如果时间片在各个队列之间划分,则其本质上将成为可抢占的。

  • 好处 –
    该算法的主要优点是我们可以在不同的队列中同时使用各种算法,例如FCFS,SSJF,LJF等。
  • 缺点–
    最低级别的过程遭受饥饿问题的困扰。

2.最短工作优先(SJF):
它基于过程的突发时间。根据进程的突发时间将其放入就绪队列。在该算法中,首先处理突发时间最少的过程。仅比较那些在该时间之前存在或已经到达的进程的突发时间。它在本质上也是非抢先的。它的抢占版本称为最短剩余时间优先(SRTF)算法。

该算法的主要优点在于,它为给定的一组处理提供了最小的等待时间,从而减少了平均等待时间。该算法的缺点是长进程可能永远不会被系统处理,并且可能会在队列中保留很长时间,从而导致进程匮乏。

笔记 –
如果两个进程的突发时间相同,则使用FCFS断开连接,即首先处理最先到达的进程。

SJF和多级别队列调度之间的区别:

Shortest Job First (SJF) Multi Level Queue Scheduling (MLQ)
SJF is also non-preemptive but its preemptive version is also there called Shortest Remaining Time First (SRTF) algorithm. MLQ can be non-preemptive or preemptive depending on the conditions.
It executes the processes in descending order of their burst time i.e. shortest job is executed first. 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.
The overhead in SJF is due to the fact that time elapsed has to be recorded. MLQ has some CPU overhead as it needs to switch between the queues.
Average waiting time is minimal in case of SJF. Average waiting time depends upon the algorithms used in various levels of queues.
The major difficulty in its implementation is that length of next CPU burst is unknown. It is complex algorithm and is difficult to implement.
It leads to starvation of processes which have very large burst times. It leads to the starvation of processes at lower levels.