Problem Statement
What is a livelock? How is it different from a deadlock? Give an example.
Explanation
A livelock is a situation where processes or threads continuously change their state in response to one another but none makes progress. Unlike deadlock (complete standstill because of waiting), livelock is active but unproductive. For example, two processes repeatedly yield to each other’s resource requests but neither gets the resource. In interviews mentioning contrast with deadlock, detection difficulty and prevention strategies adds depth.
