最短剩余时间调度算法_LRTF:最长剩余时间优先调度算法

最短剩余时间调度算法

LRTF, which stands for Longest Remaining Time First is a scheduling Algorithm used by the operating system to schedule the incoming processes so that they can be executed in a systematic way. This algorithm schedules those processes first which have the longest processing time remaining for completion. This algorithm can also be called as the preemptive version of the LJF scheduling algorithm. However, like the LJF, this algorithm is also not.

LRTF代表最长剩余时间优先,是一种调度算法,操作系统使用它来调度传入的进程,以便可以系统地执行它们。 该算法首先调度那些剩余的处理时间最长的进程。 该算法也可以称为LJF调度算法的抢占版本。 但是,与LJF一样 ,该算法也不是。

Let us take an example to understand it further. Suppose there are three processes with process Id's P1, P2, P3, and P4, and they have the following details:

让我们举个例子来进一步理解它。 假设存在三个进程Id为P1,P2,P3和P4的进程,它们具有以下详细信息:

最短剩余时间调度算法_LRTF:最长剩余时间优先调度算法_第1张图片

Gant Chart:

甘特图:

LRTF algorithm

Explanation: Each cell under the columns P1, P2, P3, and P4 denotes the remaining time required by that process for being completed.

说明:P1P2P3P4下的每个单元格表示该过程完成所需的剩余时间。

最短剩余时间调度算法_LRTF:最长剩余时间优先调度算法_第2张图片

Note: Here, after all the process are left at the same time, then the execution order depends upon the arrival time. The process which has arrived first will be executed first in such cases.

注意:在此,所有进程同时离开后,执行顺序取决于到达时间。 在这种情况下,将首先执行最先到达的过程。

Calculations:

计算:

最短剩余时间调度算法_LRTF:最长剩余时间优先调度算法_第3张图片
    Total Turn Around Time = 9 + 9 + 7 + 7
                = 32 milliseconds
    Average Turn Around Time= Total Turn Around Time / Total No. of Processes
                = 32 / 4
                = 8 milliseconds

    Total Waiting Time = 7 + 4 + 4 + 5
                = 20 milliseconds
    Average Waiting Time = Total Waiting Time / Total No. of Processes
                = 20 / 4
                = 5 milliseconds

Note: It can be observed that in spite of having much less burst time of each process, the average waiting time and average turn-around time is much high.

注意:可以看出,尽管每个过程的突发时间都少得多,但平均等待时间和平均周转时间仍然很高。

翻译自: https://www.includehelp.com/operating-systems/lrtf-longest-remaining-time-first-scheduling-algorithm.aspx

最短剩余时间调度算法

你可能感兴趣的:(算法,java,操作系统,python,深度学习)