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

📅  最后修改于: 2021-09-27 15:11:51             🧑  作者: Mango

1. 多级队列调度(MLQ):
只有一个队列并调度所有进程是非常困难的。这是使用多级队列调度的地方。在这种情况下,进程根据进程的属性分为不同的类,例如系统进程、I/O 进程等。因此我们得到 n 类进程的“n”个队列。每个队列都有一个优先级,可以使用自己的调度算法,方便同时使用多种调度算法。通常,队列的最高级别具有最高优先级,随着我们移动到较低级别而降低。如果上层具有相对于下层的绝对优先级,则它是不可抢占的,否则,如果时间片在各个队列之间划分,则它本质上是可抢占的。

  • 优点 –
    该算法的主要优点是我们可以在不同的队列中同时使用FCFS、SJF、LJF等多种算法。
  • 缺点——
    最底层的进程会遇到饥饿问题。

2. 最长作业优先(LJF):
Longest Job First 是一种非抢占式调度算法。该算法基于进程的突发时间。根据它们的突发时间,即按照突发时间的降序将进程放入就绪队列。顾名思义,该算法基于以下事实:首先处理具有最大突发时间的进程。只有那些进程的突发时间才被认为是在那个时间之前到达系统的。它的抢占式版本称为最长剩余时间优先(LRTF)算法。

笔记 –
如果两个进程具有相同的突发时间,则使用 FCFS 打破平局,即首先处理先到达的进程。

缺点——

  • 该算法为给定的一组进程提供了非常高的平均等待时间和平均周转时间。
  • 这可能会导致车队效应。
  • 可能会发生一个短进程可能永远不会被执行而系统继续执行较长进程的情况。
  • 它降低了处理速度,从而降低了系统的效率和利用率。

最长作业优先 (LJF) 和多级队列调度 (MLQ) 之间的区别:

S.NO. Longest Job First (LJF) Multi Level Queue (MLQ)
1. It executes processes based upon their burst time i.e. in descending order of their burst times. 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.
2. It is non-preemptive but its preemptive version is also there called Shortest Remaining Time First (SRTF) algorithm. It can be both preemptive and non preemptive in nature depending upon conditions.
3. The average waiting time for given set of processes is quite long which reduces effectiveness of system. There is no idea of average waiting time and response time as it completely depends upon algorithms used in various levels of multi-level queue.
4. A long process may never get executed and system may keep executing short processes. It leads to starvation of processes at lower levels of multi level queue.