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, the system must satisfy at least one of the deadlock conditions :
1. Mutual exclusion condition: a resource cannot be shared and must be mutually exclusive.
2. Hold and wait condition: a process holding at least one resource is waiting to acquire additional resources held by other processes.
3. No-preemption condition: a resource cannot be preempted from a process that is already holding it.
4. Circular wait condition: there exists a circular chain of two or more processes, each of which is waiting for a resource held by the next process in the chain.
To avoid circular wait condition, we need to ensure that each process can always obtain all the resources it needs in a single request. Therefore, we need to ensure that the total number of instances of the resource type is at least as large as the sum of the maximum requests of the processes.
Total number of instances = 4
Let the maximum request of each process be K.
Therefore, the sum of the maximum requests = 3K.
To avoid deadlock, we need to ensure that 3K <= 4,="" i.e.,="" k="">=><=>=>
Since K needs to be an integer, the largest value of K that will always avoid deadlock is 2 (since 3*2=6>4 and 3*1=3<4). therefore,="" option="" b="" is="" the="" correct="" answer.="" therefore,="" option="" b="" is="" the="" correct="">4).>
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).