What is starvation?

Submitted by: Administrator
Starvation is a situation when some threads acquired the shared resources for long time and therefore other threads are not able to access those resources and not able to do anything further.
For example, suppose an object provides a synchronized method that often takes a long time to return.
If one thread invokes this method frequently, other threads that also require frequent synchronized access to that object will be blocked.
In Java, Starvation can be caused by inappropriate allocation of thread priorities.
A thread with low priority can be starved by the threads of higher priority if the higher priority threads do not release shared resources time to time.
Submitted by: Administrator

Read Online Java Multi-Threading Job Interview Questions And Answers