An operating system contains 3 user processes each requiring 2 units of…
1997
An operating system contains 3 user processes each requiring 2 units of resource R. The minimum number of units of R such that no deadlocks will ever arise is
- A.
3
- B.
5
- C.
4
- D.
6
Attempted by 49 students.
Show answer & explanation
Correct answer: C
For 3 processes each requiring 2 units of resource R, the minimum number to avoid deadlock is calculated using N*(max-1)+1 = 3*(2-1)+1 = 4 units. This ensures that even if each process holds (max-1)=1 unit, at least one more unit remains available to complete a process and release its resources.
If each process get 1 resource and we have 3 resources then each process will wait for another one resource creating Deadlock. if we have 1 more resource (e.g. 4 resources) then anyone of them will get that resource and complete it's work and after that release the resources making the system deadlock free.