Given: A system has R identical resources, P processes competing for them and N is the maximum need of each process. The task is to find the minimum number of Resources required So that deadlock will never occur.
R >= P * (N - 1) + 1
Input : P = 3, N = 4 Output : R >= 10 Input : P = 7, N = 2 Output : R >= 8
Consider, 3 process A, B and C.
Let, Need of each process is 4
Therefore, The maximum resources require will be 3 * 4 = 12 i.e, Give 4 resources to each Process.
And, The minimum resources required will be 3 * (4 – 1) + 1 = 10.
i.e, Give 3 Resources to each of the Process, and we are left out with 1 Resource.
That 1 resource will be given to any of the Process A, B or C.
So that after using that resource by any one of the Process, It left the resources and that resources will be used by any other Process and thus Deadlock will Never Occur.
R >= 10
- Introduction of Deadlock in Operating System
- Recovery from Deadlock in Operating System
- Deadlock Detection Algorithm in Operating System
- Free space management in Operating System
- Operating Systems | Deadlock | Question 1
- Operating Systems | Deadlock | Question 2
- Hierarchical Deadlock Detection in Distributed System
- Multithreading in Operating System
- Introduction of Operating System - Set 1
- Functions of Operating System
- Thread in Operating System
- Segmentation in Operating System
- Paging in Operating System
- Benefits of Multithreading in Operating System
- Threads and its types in Operating System
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.