in Operating System edited by
25 votes

Which of the following is not a valid deadlock prevention scheme?

  1. Release all resources before requesting a new resource.
  2. Number the resources uniquely and never request a lower numbered resource than the last one requested.
  3. Never request a resource after releasing any resource.
  4. Request and all required resources be allocated before execution.
in Operating System edited by

Subscribe to GO Classes for GATE CSE 2022

2 Answers

37 votes
Best answer

The answer is (C).

  1. is valid. Which dissatisfies Hold and Wait but ends up in starvation.
  2. is valid. Which is used to dissatisfy circular wait.
  3. is invalid.
  4. is valid and is used to dissatisfy Hold and Wait.
edited by


C is invalid, because it is more like 2 phase locking protocol. Acquire phase & Release phase. We know that even in 2 phase locking deadlock is possible, so C is not really preventing Deadlock. So C is answer. (Adding information as why C is invalid is not present ! )

Actually, C increases the chances of deadlock. You are not allowed to request resources after releasing some resources. So if you require to request some resources and for some of the other resources you have finished your work, What will you do?

You will not release those for which you have finished work and request those you required. So you are holding more number of resources which might be useful for some other process. Increase the chance of deadlock.

thanks akash kanase for providing exact approach for option c
edited by

@Gate Keeda @Akash Kanase @Hemant Parihar @talha hashim

Why option B is valid ?

For deadlock prevention in circular wait:

1. We number the resources uniquely

2. The process can request for the resource only in the increasing or decreasing order of numbering

So if we consider the numbering in decreasing order then the process will request the resource in lower numbered  only & the option says "never request" ?

Please explain where I am going wrong.


 you are right but if we are only considering increasing order then also it is valid as deadlock prevention scheme.

0 votes
Option A is valid, it will help to violate hold and wait condition. Whenever you request a new resource you release all the previously acquired resources.

Option B is Valid, it is the standard method used for removing circular wait.

Option D is valid, it will also remove Hold and Wait condition.

Hence, option C is the invalid option. And it is invalid also because if you release the resource, some or the other process will be able acquire it and complete execution. Hence, the process can request for a new resource without causing deadlock.

Related questions