Aging in operating system
In Operating systems, Aging is a scheduling technique used to avoid Starvation. Fixed priority scheduling is a scheduling discipline in which tasks queued for utilizing a system resource is assigned each priority. A task with a high priority is allowed to access a specific system resource before a task with a lower priority is allowed to do the same.
Aging is a technique of gradually increasing the priority (by time quantum) of processes that wait in the system for a long time. By doing so, as time passes, the lower priority process becomes a higher priority process.
A disadvantage of this approach is that tasks assigned with a lower priority may be starved when many high priority tasks are queued. Aging is used to gradually increase the priority of a task based on its waiting time in the ready queue.
In priority-based scheduling algorithms, a major problem is an indefinite block or Starvation. A process that is ready to run but waiting for the CPU can be considered blocked. A priority scheduling algorithm can leave some low-priority processes waiting indefinitely. A steady stream of higher-priority processes can prevent a low-priority process from ever getting the CPU.
- Increasing Process
If priority ranges 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 processes to age to a priority-0 process.
- Decreasing Process
If a process P has a priority number as 127 at 0 minutes, then after every 15 minutes (time quantum), decreasing the priority number of the process P by 1. So, after 15 m, the priority of the process P will be 126. Again after 15 m, decreasing the priority number of process P by 1. So, after 30 m, the priority of the process P will become 125, and this process will continue. Process P will become a high priority process when the priority number comes closer to 0, and process P will get the CPU for its execution after a very long time.
Uses of Aging
Aging is used to ensure that jobs with lower priority will eventually complete their execution. This technique can be used to reduce the Starvation of low priority tasks. There are many ways to implement Aging, but all have the same principle that the priority of a process should increase as it waits in the ready queue. The increase in priority may or may not be equal to the waiting time of the process