in Operating System
146 views
0 votes
0 votes
MSQ

 

Which of the following statements is/are TRUE?

  1. If safe state exists, deadlock can be avoided if resources are allocated properly
  2. If safe state exists, deadlock is never possible in future
  3. Unsafe state always leads to a deadlock
  4. Even if safe state exists, deadlock is possible, if resources are poorly allocated
  5. Unsafe state may lead to a deadlock
in Operating System
146 views

4 Comments

1,4,5are true
1
1
How 4 and 5 are true?
0
0
Safe state does not guarantee a deadlock free system. Safe state means we have a sequence, which if followed will give us a deadlock free operation. But resources can be allocated in such a manner that the system may enter into deadlock.

Suppose you have $4$ processes ($P_1$,$P_2$,$P_3$,$P_4$) where $P_3$ and $P_4$ has no requirements now, but $P_1$ and $P_2$ needs $3$ and $4$ instance of resources respectively to finish execution.
Let’s say $P_3$ holds $2$ instances of resource at max and $P_4$ holds $3$ instances of resource max. Now, if both releases the resources we’ll get total of $5$ instances of resources. Now coming to Option A, it is saying that my system is deadlock free as max requirement is by $P_2$ which is $4$ and it is less than total free reources $5$.
But what if we allocate $2$ out of the $5$ resources to $P_3$ and remaining $3$ resources to $P_4$. $P_3$ and $P_4$ will both still need 1 resource but we have exhausted all resource. Hence system gets into deadlock.\

Even unsafe state does not guarantee deadlock. A process can pre-empt and release all its resources to make the state safe.
3
3
How you're getting 4 and 5 .. it's 1 4  5
0
0

Please log in or register to answer this question.

Related questions