
Starvation:
Starvation is a situation in which a thread is not granted enough CPU time and it starves to death due to lack of it. This is an un wanted situation for a particular thread and the goal of multi threading is compromised.
Let’s see some of the causes of starvation.
- Threads which are having a high priority eat up most of the or all of the CPU time from threads which have a lower priority.
- Some Threads are blocked waiting to enter a synchronized block because other threads are continuosly accessing it.
- Threads are waiting on an object by calling wait method but are continuosly in wait state and waiting to be notified.
Fairness:
Fairness is a process in which all threads are granted decent amount of time. It is ‘fair’ allocation of CPU time to all threads.
Thanks for reading!!!