# Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 20 (Page No. 467)

1 vote
66 views
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.

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.

edited by

## Related questions

1
40 views
One way to eliminate circular wait is to have rule saying that a process is entitled only to a single resource at any moment. Give an example to show that this restriction is unacceptable in many cases.
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?$
Suppose that process $A$ in Fig. 6-12 requests the last tape drive. Does this action lead to a deadlock?