I need a solution for following scenario.
1. Suppose two processes running simulteneously.
2. Process (P1) has already locked a mutex (M1).
3. Process (P2) is trying to lock same mutex (M1) but as it is already locked by (P1), P2 is waiting for unlocking (M1).
4. Now somehow process (P1) terminates or dies wihtout unlocking mutex (M1).
5. (P2) is still waiting for unlocking (M1). But as (P1) is dead now there is no other way to unlock the mutex.
6. In this situation, (P2) experiences a deadlock.
How to resolve this kind of situation.