![]() |
VOOZH | about |
Starvation (or indefinite blocking) occurs in priority scheduling when a low-priority process keeps waiting indefinitely because higher-priority processes continuously get the CPU.
Example:
Process | Burst Time | Priority |
|---|---|---|
P1 | 4 | 1 |
P2 | 7 | 10 |
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.
Aging is a scheduling technique used to prevent starvation by gradually increasing the priority of processes waiting too long in the system.
For example, if priorities range from 127 (low) to 0 (high), a waiting process can move up one level every 15 minutes, ensuring even the lowest-priority process eventually gets executed.
Starvation | Aging |
|---|---|
A process waits indefinitely for CPU or resources. | A technique that gradually increases a processโs priority to avoid starvation. |
It is a problem in scheduling. | It is a solution to fix that problem. |
The priority of the waiting process does not change, so it keeps waiting. | The priority of the waiting process increases over time, helping it run. |
A process may never get CPU and may wait forever. | Ensures every process eventually gets CPU after waiting for some time. |