Log In
1 vote
Can a system be in a state that is neither deadlocked nor safe? If so, give an example. If not, prove that all states are either deadlocked or safe.
in Operating System 66 views

1 Answer

0 votes

Safe state will never lead to deadlock. Unsafe state may lead to a deadlock. Deadlock is subset of unsafe state.


There are states that are neither safe nor deadlocked, but which lead to deadlocked states. As an example, suppose we have four resources: tapes, plotters, scanners, and CD-ROMs, as in the text, and three processes competing for them. We could have the following situation:

       Has         Needs       Available

A: 2 0 0 0      1 0 2 0        0 1 2 1

B: 1 0 0 0      0 1 3 1

C: 0 1 2 1     1 0 1 0

This state is not deadlocked because many actions can still occur, for example, A can still get two printers. However, if each process asks for its remaining requirements, we have a deadlock.

Ref: Andrew Tanenbaum solution manual.

Also see:

edited by

Related questions

2 votes
0 answers
0 votes
2 answers
0 votes
1 answer
The banker’s algorithm is being run in a system with $m$ resource classes and $n$ processes. In the limit of large $m$ and $n,$ the number of operations that must be performed to check a state for safety is proportional to $m^{a} n^{b}.$ What are the values of $a$ and $b?$
asked Oct 30, 2019 in Operating System Lakshman Patel RJIT 72 views