Anonymous user menu

What is the minimum number of resources required to ensure that deadlock will never occur?

What is the minimum number of resources required to ensure that deadlock will never occur, if there are currently three processes P1,P2P1,P2 and P3P3 running in a system whose maximum demand for the resources of same type are 3, 4, and 5 respectively.

  1. 3
  2. 7
  3. 9
  4. 10

also suggest me what name should i search on youtube to better understand these kind of prblms

4Comments
Sumit Verma @sumitverma
25 Apr 2017 01:28 pm

Method:
Step1. Allocate the resources to the processes one less than the maximum need.
    i.e, allocated [Max need - 1] to every process.
Step 2. Add one more resource at the end to ensure that at least one of the process can fulfill his max need. This will be minimum number of resources that are required for deadlock free system.
Example: In the above question:
Max need of P1 = 3
Max need of P2 = 4
Max need of P3 = 5
Apply step 1
Resources allocated to P1 = 2
Resources allocated to P2 = 3
Resources allocated to P3 = 4
Total allocated resources = 2+3+4 = 9 (This will be maximum number of resources that may cause deadlock )
Apply Step2:
Minimum number of resources to ensure deadlock will not occur = 9+1 = 10.
Hence option 4 is correct.

shweta @shweta1920
25 Apr 2017 01:14 pm

if 9 is the min resources required that may cause deadlock then ... 10 resources must bring deadlock ..?isnt it?

Sumit Verma @sumitverma
25 Apr 2017 01:27 pm

@shweta1920
No, you are taking it in wrong way.
9 is the maximum number of resources that may cause deadlock. Consider the case when P1 has 2, P2 has 3 and P3 has 4 resources and the system is in deadlock. If you will any one more resource then any of the process can take that resource and complete it's execution.
Is it clear?

shweta @shweta1920
25 Apr 2017 04:52 pm

yesss... all clear ,,

thank u