597 views
7 votes
7 votes

Which of the following is/are correct about deadlocks in an Operating System? (Mark all the appropriate choices)

  1. If a system is in a safe state, it will never enter a deadlock after a sequence of resource allocations. 
  2. If a system is in an unsafe state, it will eventually enter a deadlock.
  3. Deadlock prevention is stricter that deadlock avoidance.
  4. Deadlock prevention ensures better resource utilization than deadlock avoidance.

1 Answer

Best answer
10 votes
10 votes
A safe state means there is a safe sequence of possible resource allocations which guarantees deadlock freedom. But if we follow an unsafe sequence, there can be a deadlock.

If a system is in an unsafe state, then there is not any possible safe sequences for resource allocation. But this still does not guarantee that there is a deadlock or there will be a deadlock. For example a process may free up a resource even without finishing its execution. So, both options A and B are false.

Deadlock prevention is more stricter than deadlock avoidance. In deadlock prevention, we need to ensure one of the four necessary conditions of deadlock does not occur. So, it may be the case that a resource request might be rejected even if the resulting state is safe. (One example, is when we impose a strict ordering for the processes to request resources).

Deadlock avoidance is less restrictive than deadlock prevention. Deadlock avoidance is like a police man and deadlock prevention is like a traffic light. The former is less restrictive and allows more concurrency. For the same reason, deadlock prevention ensures lesser resource utilization than deadlock avoidance. Option C is true and option D false.

Correct answer: C
selected by
Answer:

Related questions