An operating system contains 3 user processes each requiring 2 units o...
Total process = 3 and each require 2 units of resource. If we give 1 resource to 1 process then total resource = 1 + 1 + 1 = 3 but in this case deadlock will definitely occur because each process hold 1 unit resource and waiting for another resource so if we increase 1 more resource (3+1=4) then deadlocks will ever arise (i.e., when process 1 complete their execution then it free 2 resource and this 2 resource will used by another process.). Option (B) is correct.
An operating system contains 3 user processes each requiring 2 units o...
Explanation:
In order to avoid deadlocks, we need to make sure that each process can acquire the required resources without any resource being held indefinitely by another process.
Understanding the Problem:
- There are 3 user processes.
- Each process requires 2 units of resource R.
- We need to find the minimum number of units of R such that no deadlocks will ever arise.
Resource Allocation:
- If we have only 2 units of resource R, then it is possible for each process to acquire 1 unit of R, but the remaining unit will be unavailable.
- This can lead to a deadlock situation where each process is waiting for the additional unit of R that is held by another process.
- To avoid deadlocks, we need to ensure that all processes can acquire the required 2 units of R simultaneously.
Minimum Number of Units:
- If we allocate 3 units of resource R, each process can acquire the required 2 units simultaneously without any deadlock.
- This is because there are enough units of R available for all processes to proceed without waiting for each other.
- Therefore, the minimum number of units of R required to avoid deadlocks is 3.
Answer:
The correct answer is option B) 5.
Additional Explanation:
- In this scenario, each process requires 2 units of resource R.
- If we allocate only 4 units of R, it is possible for two processes to acquire 2 units each, but the third process will be left waiting.
- This can lead to a deadlock situation where the third process is waiting for the additional 2 units of R that are held by the other two processes.
- Therefore, we need a minimum of 5 units of R to ensure that all processes can acquire the required resources simultaneously and avoid deadlocks.