Threading tutorial -Starvation and LiveLock in Java

Starvation and LiveLock in Java are two issues those can affect the smooth working of an application which involves many threads sharing common resources.

Starvation and LiveLock in Java

Starvation

Suppose there are multiple threads in a Java process, all needs to get lock on a particular object.Assume the first thread holds lock on the shared object for a long time. For this entire time  others threads are waiting.Suppose the long duration thread is invoking very frequently.So other threads will be blocked from accessing the shared object. This situation is referred as starvation in muti-threading.

LiveLock

It is a situation in multi-threading  when two or more threads are unable to make any progress and they are not blocked each other.These threads are responding to each other to finish the tasks,but no progress is going to happen.

 

See Related Discussions

Threading Basics

Thread Safety in Java

Thread Communication in Java

Thread Priorities in Java

The join() method in Threading

The yield() method in Threading

The sleep() method in threading

Daemon Threads in Java

ThreadPoolExecutor in Java

Creating Thread Pools in Java

Thread Dead Lock in Java