Thread Starvation in java


Thread starvation happens when thread does not enough CPU for its execution.

Thread starvation may happen in following scenarios >

  • Low priority threads gets less CPU (time for execution) as compared to high priority threads. Lower priority thread may starve away waiting to get enough CPU to perform calculations.

  • In deadlock two threads waits for each other to release lock holded by them on resources. There both Threads starves away to get CPU.

  • Thread might be waiting indefinitely for lock on object’s monitor (by calling wait() method), because no other thread is calling notify()/notifAll() method on object. In that case, Thread starves away to get CPU.

  • Thread might be waiting indefinitely for lock on object’s monitor (by calling wait() method), but notify() may be repeatedly awakening some other threads. In that case also Thread starves away to get CPU.


/** JavaMadeSoEasy.com */

RELATED LINKS>


Thread Starvation

Constructor in java cannot be synchronized

ThreadLocal in multithreading in java - methods and usage with program

Busy Spin - What is busy spin? Consumer Producer problem with busy spin and solution to busy spin.

ThreadGroup in java


No comments:

Post a Comment