Open In App

Starvation and Aging in Operating Systems

Starvation occurs when a process in the OS runs out of resources because other processes are using it. This is a problem with resource management while Operating systems employ aging as a scheduling approach to keep them from starving. It is one of the most common scheduling algorithms in batch systems. Each process is assigned a priority. The process with the highest priority is to be executed first and so on. Here we will be discussing a major problem related to priority scheduling and its solution.

What is Starvation?

Starvation or indefinite blocking is a phenomenon associated with the Priority scheduling algorithms, in which a process ready for the CPU (resources) can wait to run indefinitely because of low priority. In a heavily loaded computer system, a steady stream of higher-priority processes can prevent a low-priority process from ever getting the CPU. There have been rumors that in 1967 Priority Scheduling was used in IBM 7094 at MIT, and they found a low-priority process that had not been submitted till 1973.



Example:

Process

Burst Time

Priority

P1

4

10

P2

7

1

P3

10

2

Gantt Chart



P1

P3

P2

0

4

14

21

As we see in the above example process has higher priority than other processes getting CPU earlier. We can think of a scenario in which only one process has very low priority (for example 127) and we are giving another process with high priority, this can lead to indefinitely waiting for the process for CPU which has priority, which leads to Starvation. Further, we have also discussed the solution to starvation. 

Reasons of Starvation

How to Control Starvation?

Differences Between Deadlock and Starvation in OS

Solution to Starvation: Aging

What is Aging?

Aging is a technique of gradually increasing the priority of processes that wait in the system for a long time. Operating systems employ ageing as a scheduling approach to keep them from starving. It is essentially giving long-waiting processes more importance one step at a time. It makes it more likely that they will obtain the tools they need to carry out. As a result, there is less chance of famine. In the event that the waiting process is not selected for execution, a higher priority is assigned to it. It guarantees that lengthy-waiting procedures are given an equal opportunity to complete. Ageing is combined with other scheduling techniques to avoid famine. Take round-robin or priority scheduling, for instance. It supports process scheduling by preserving a balance between immediate and long-term fairness. For example, if priority range from 127(low) to 0(high), we could increase the priority of a waiting process by 1 Every 15 minutes. Eventually, even a process with an initial priority of 127 would take no more than 32 hours for the priority 127 process to age to a priority-0 process.

Uses of Aging

Limitation of Aging

Frequently Asked Question on Starvation and Aging – FAQs

How is starvation avoided in OS?

Ageing is a method that raises the priority level of low-priority processes over a certain amount of time in order to prevent starvation in the operating system. As a result, both the high priority processes and the lowest priority processes will be able to continue existing and operating.

Can aging lead to priority inversion issues?

Yes aging leads to priority inversion problem

Can aging be used with real-time systems?

Real-time systems can benefit from the use of ageing, but its implementation must be carefully planned to save processing cost and guarantee that problems with priority inversion do not interfere with real-time requirements.


Article Tags :