Problem associated with priority scheduling and its solution

In this tutorial, we will learn about the problem associated with priority scheduling and its solution. By Basantjeet Das Last updated : May 07, 2023

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.

Starvation problem of a process

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.

Example

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'.

Solution

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.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.