📌  相关文章
📜  多级队列(MLQ)调度与轮循(RR)算法之间的区别

📅  最后修改于: 2021-08-25 18:16:07             🧑  作者: Mango

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

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

2.轮循(RR):
它是专为分时系统而设计的。进程被放入就绪队列,在这种情况下,该队列是循环队列。在这种情况下,定义了一个小的时间单位,称为时间量。该算法从队列中选择第一个进程,并在时间量所定义的时间内执行它。如果该进程的突发时间小于该时间量,则CPU执行下一个进程,但如果其突发时间大于该时间量,则该过程被中断,并针对相同的时间量执行下一个进程。如果某个进程被中断,则会发生上下文切换,并将该进程放回队列的尾部。它本质上是先发制人的。

该算法主要取决于时间量。很大的时间量会使RR与FCFS相同,而很小的时间量将导致开销,因为上下文切换将在非常小的间隔后一次又一次地发生。

该算法的主要优点是,所有进程都一个接一个地执行,这不会导致进程出现饥饿或等待进程等待很长时间才能执行。

MLQ和轮询(RR)调度算法之间的区别:

MLQ Round-Robin (RR)
MLQ executes the process depending upon the priority if the level of queue in which the process resides and further execution is dependent upon the algorithm used in that level. Round-Robin (RR) executes the processes based upon the time quantum defined i.e. each process is executed for a fixed amount of time.
MLQ can be both non preemptive and preemptive depending upon the conditions. Round-Robin (RR) is preemptive in nature.
The average waiting time for given set of processes is dependent upon the tupe of algorithms used in various levels of multi level queue. The average waiting time for given set of processes is quite small and depends on the time quantum.
It is quite complex and difficult to implement. It is quite easy to implement RR.
It leads to the starvation of processes at the lower levels. Each process is executed and every user feels that his work is being done as the CPU gives equal amount of time to each process.
Switching between different levels causes overhead on the processor. In case of RR, if the time quantum is very small then context switch takes place again and again after very short intervals of time which leads to overhead.