Sam has designed an application. It segregates tasks that are critical and executed frequently
from tasks that are non critical and executed less frequently. He has prioritized these tasks based
on their criticality and frequency of execution. After close scrutiny, he finds that the tasks designed
to be non critical are rarely getting executed.
From what kind of problem is the application suffering?
A.
race condition
B.
starvation
C.
deadlock
D.
livelock
Explanation:
Starvation describes a situation where a thread is unable to gain regular access to
sharedresources and is unable to make progress. This happens when shared resources are made
unavailable forlong periods by “greedy” threads. For example, suppose an object provides a
synchronized method that oftentakes a long time to return. If one thread invokes this method
frequently, other threads that also need frequentsynchronized access to the same object will often
be blocked.
Reference: The Java Tutorial, Starvation and Livelock
The answer is B – the explanation is great and it is just for starvation!
+1
Should be B
Correct answer is indeed B: Starvation.
Starvation occurs when threads with higher priority are always ran, leaving the threads with lower priority in the queue. They’re never run.