Consider a system with 3 processes that share 4 instances of the same ...
Given, Number of processes (P) = 3 Number of resources (R) = 4 Since deadlock-free condition is:
R ≥ P(N − 1) + 1
Where R is total number of resources, P is the number of processes, and N is the max need for each resource.
4 ≥ 3(N − 1) + 1
3 ≥ 3(N − 1)
1 ≥ (N − 1)
N ≤ 2
Therefore, the largest value of K that will always avoid deadlock is 2. Option (B) is correct.
View all questions of this test
Consider a system with 3 processes that share 4 instances of the same ...
Solution:
To avoid deadlock, we need to ensure that a process never gets stuck waiting for a resource that is held by another process. One way to do this is to ensure that each process can always get all the resources it needs in a single request. If a process can request only a limited number of resources at a time, it may have to wait for other processes to release resources before it can get all the resources it needs, which could lead to deadlock.
Given that each process can request a maximum of K instances, the largest value of K that will always avoid deadlock is:
K=2
Here's why:
- If each process can request only 1 instance at a time (i.e., K=1), then deadlock is possible if each process holds 1 instance and is waiting for 1 more instance that is held by another process. In this case, no process can proceed, and deadlock occurs.
- If each process can request 2 instances at a time (i.e., K=2), then deadlock is not possible. Each process can get all the resources it needs in a single request, so there is no possibility of a circular wait.
- If K>=3, then deadlock is possible if each process holds K-1 instances and is waiting for 1 more instance that is held by another process. In this case, no process can proceed, and deadlock occurs.
Therefore, the largest value of K that will always avoid deadlock is 2.
To make sure you are not studying endlessly, EduRev has designed Computer Science Engineering (CSE) study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Computer Science Engineering (CSE).