A scheduling algorithm with a priority queue that also employs the aging mechanism might be used to combat famine. Aging is a method of progressively boosting the priority of processes that have been sitting idle in the system for a long period. Over time, these processes will rise to the top of the queue and be given higher priority over active processes.
Deadlock, which causes a process to freeze, is usually the source of starvation. They will then be given priority when it comes time to schedule another process. This means that starved processes will eventually be given priority.
In batch systems, it is one of the most often used scheduling methods. Each process has a priority assigned to it. Starvation, sometimes known as endless blocking, is a phenomena linked with priority scheduling algorithms in which a ready-to-run activity on the CPU might wait forever due to low priority. For example, if a high priority process keeps the CPU busy while all the other processes are waiting for their turn, then everyone else will starve to death.
There are two ways to avoid this problem: use round-robin scheduling or increase the priority of active tasks. With round-robin scheduling, every part of the job gets equal time on the computer. So even if one task takes a long time, the others will still get a chance to run.
With increased priority, the scheduler gives higher priority to activities that are more important to the job. So even if there are many activities with high priority, only one will actually get executed at any given time. Increasing the priority of an activity makes sure it gets its turn despite other activities being able to use the CPU longer.
Starvation can also happen if there are too many low priority activities. In this case, too many high priority activities will keep the low priority tasks from running. An easy fix for this problem is to reduce the priority of some tasks so they can catch up on their turns.
Random process selection for resource allocation or processor allocation should be avoided since it promotes hunger. The resource allocation priority system should contain ideas such as aging, in which the priority of a process increases the longer it waits. This prevents famine. In addition, there should be a maximum resource limit that cannot be exceeded, and resource quotas representing available resources.
During famine, resources are constantly depleted by high-priority activities. Aging can help alleviate the problem of famine... The Distinction Between Deadlock and Starvation
|5.||It can be prevented by avoiding the necessary conditions for deadlock||It can be prevented by Aging|
An example for this is when a high-priority interrupt occurs and the operating system needs time to service that interrupt but all ready-to-run tasks have high priority.
This behavior may occur because certain devices (such as disk drives) are always given highest priority by the operating system. If a task waits for data from one of these devices then it will never return until something changes about either the state of the device or the amount of time that has passed since the task last checked it. In this case, the device represents an infinite blockage that prevents any other tasks from executing.
The term is also applied when a task with a lower priority than another waits for a signal from another process. In this case, the task will not be woken up until the higher-priority task sends it a signal. If the lower-priority task doesn't wake up within a specified time, then it will be considered blocked and waited for again next time round the loop.
Finally, starvation can also apply to threads within a single process. This can happen if one thread is constantly waiting for some resource that is not available to it.
Indefinite block, or hunger, is a fundamental issue in priority-based scheduling systems. A blocked process is one that is ready to run but is awaiting the CPU. Some low-priority activities may be left waiting forever by a priority scheduling method. This is not an optimal use of resources and is therefore undesirable.
Starvation is another term for infinite blocking. In other words, a process will never run because there are still other processes that are blocking on it. Starvation can also occur because there are no free resources available for any process to use. For example, this could be because all the CPUs are in use and no process can acquire a resource (such as a queue) that would allow it to run.
It is important to understand that starvation is a possibility with any scheduling strategy. It is only bad if it occurs often enough to matter. For example, if a high-priority process always gets starved even though there are free resources available, then this shows that the system needs improvement. However, if low-priority processes often get starved and high-priority processes do not, then this indicates that the system is working properly. There may be times when both high- and low-priority processes get starved, but this does not mean that the system is wrong.
In conclusion, starvation is a possible problem with any scheduling strategy. It is only bad if it happens often enough to matter.
When famine happens, there aren't enough resources to go around, and the processes' priority begins to dwindle. To maintain everything working as it should, one of the running processes must pause its progress and hand over (roll back) a system resource to another process. This other process will then resume its work on top of the paused task.
So in short, starvation occurs when someone needs something but nobody can give it to them. The thing is not to give up though, there has to be a way through this!