优先级调度算法动态优先级
We are already familiar with what Priority Scheduling is. It is one of the most used process scheduling algorithm used in operating systems, in which every process is assigned with a priority. According to this algorithm, the process with the highest priority is set to be provided the CPU first or simply is to be executed first.
我们已经熟悉什么是优先调度。 它是操作系统中使用最广泛的进程调度算法之一,在该算法中,每个进程都分配了优先级。 根据该算法,将优先级最高的过程设置为首先提供给CPU或简单地首先执行。
In priority scheduling algorithm, a major problem to be considered is the starvation of a process i.e. a process which is ready to be executed but is waiting for the CPU because of its low priority. This can lead to the indefinite waiting of the low-priority processes. A continuous flow of higher priority processes to the O.S can prevent a low priority process from ever getting the CPU.
在优先级调度算法中 ,要考虑的主要问题是进程的饥饿 ,即由于其低优先级而准备执行但正在等待CPU的进程。 这可能导致无限期等待低优先级进程。 高优先级进程不断流向OS可以防止低优先级进程获得CPU。
Let's take an example to understand what starvation is. Suppose there are 100 processes in which a process 'X' has the lowest priority because of which it will be executed at last. Let say before the process 'X' is provided CPU for the execution some more processes are provided to the operating system having a priority higher than that of process 'X'. Now what will happen is, the process 'X' won't get the chance to get executed no matter what was its arrival time. It is possible that, as the time passes by the O.S is given more processes having higher priority than that of 'X', due to which 'X' can wait indefinitely or could never be executed. This Problem is known as 'Starvation'.
让我们举一个例子来了解什么是饥饿 。 假设有100个进程,其中进程'X'具有最低优先级,因为它最终将被执行。 可以说,在为CPU提供进程“ X”以供执行之前,向操作系统提供的其他进程的优先级高于进程“ X”的优先级。 现在将要发生的是,无论到达时间是什么,进程“ X”都不会有执行的机会。 随着时间的流逝,可能会给OS提供更多比'X'具有更高优先级的进程,因此'X'可以无限期等待或无法执行。 这个问题被称为“饥饿” 。
For solving the problem of starvation we have the concept of Aging. In aging what we do is increasing the priority of those process that has been waiting long because of low priority after some specified amount of time. Due to which after the specified time its priority is increased and could be provided with the CPU for the execution.
为了解决饥饿问题,我们有老龄化的概念。 在老化中,我们要增加由于在指定的时间量后优先级较低而一直等待很久的那些进程的优先级。 因此,在指定的时间之后,其优先级会增加,并且可以随CPU提供以执行该优先级。
翻译自: https://www.includehelp.com/operating-systems/problem-associated-with-priority-scheduling-and-its-solution.aspx
优先级调度算法动态优先级