Not all unsafe states are deadlock, however. An unsafe state may lead to deadlock
Can someone please explain how deadlock != unsafe state ? I also caught the same line here
If a safe sequence does not exist, then the system is in an unsafe state, which MAY lead to deadlock. ( All safe states are deadlock free, but not all unsafe states lead to deadlocks. )
Asked By : vikkyhacks
Answered By : Wandering Logic
Process A Process B lock X lock Y # state is "unsafe" unlock Y lock Y # state is back to "safe" (no deadlock this time. We got lucky.)
There’s a more interesting example in Section 7.5.1 of the link you gave:
Consider a system with 12 tape drives with:
Process Max Need Current P0: 10 5 P2: 9 3
This is an unsafe state. But we’re not in a deadlock. There’s only 4 free drives, so, for example, if P0 does request an additional 5, and P2 does request an additional 1, we will deadlock, but it hasn’t happened yet. And P0 might not request any more drives, but might instead free up the drives it already has. The Max need is over all possible executions of the program, and this might not be one of the executions where we need all 10 drives in P0.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/45145