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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Deadlock Ignorance in Operating System
- Conditions for Deadlock in Operating System
- Recovery from Deadlock in Operating System
- Introduction of Deadlock in Operating System
- Deadlock Detection Algorithm in Operating System
- Free space management in Operating System
- How to detect Operating System through a C program
- Operating Systems | Deadlock | Question 1
- Operating Systems | Deadlock | Question 2
- Hierarchical Deadlock Detection in Distributed System
- Difference between Deadlock Prevention and Deadlock Avoidance
- File System Implementation in Operating System
- System Protection in Operating System
- System Programs in Operating System
- Web Operating System
- Multithreading in Operating System
- Functions of Operating System
- Concurrency in Operating System
- Segmentation in Operating System
- Inode 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.