I was reading Operating Systems by Galvin and came across the below line,Not all unsafe states are deadlock, however. An unsafe state may lead  to deadlockCan someone please explain how deadlock != unsafe state ?I also caught the same line hereIf 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. )
Why unsafe state not always cause deadlock?
operating systems;deadlocks
Deadlock means something specific: there are two (or more) processes that are currently blocked waiting for each other.In an unsafe state you can also be in a situation where there might be a deadlock sometime in the future, but it hasn't happened yet because one or both of the processes haven't actually started waiting.Consider the following example:Process A                  Process Block X                     lock Y           # state is unsafe                           unlock Ylock 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       CurrentP0:             10              5P2:              9              3This 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.