Consider a system consisting of π instances of a resource π , being shared byβ¦
2026
Consider a system consisting of π instances of a resource π , being shared by 5 processes. Assume that each process requires a maximum of two instances of resource π and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance. The minimum value of π for the system to be deadlock-free is ________. (answer in integer)
Attempted by 19 students.
Show answer & explanation
Correct answer: 6
Step-by-Step Solution
To find the minimum value of k for the system to be deadlock-free, we first determine the maximum number of resources that can be held by the processes without causing a deadlock, and then add one more resource to break the potential deadlock.
1. Analyze the Worst-Case Scenario
A deadlock occurs if every process holds the maximum number of resources it can hold without completing, and no process can proceed. In this scenario:
There are 5 processes.
Each process requires a maximum of 2 instances.
A process can request the second instance only after acquiring the first. This means a process can hold 1 instance and wait for the second.
In the worst-case scenario (potential deadlock), each of the 5 processes holds 1 instance of the resource and is waiting for the second instance. No process can proceed because no resources are available to satisfy the second request.
2. Calculate Resources in Deadlock State
Number of processes = 5 Resources held per process in worst case = 1 Total resources held = 5 Γ 1 = 5
3. Determine Minimum k for Deadlock-Free System
To prevent deadlock, we need at least one extra resource beyond the worst-case scenario. This extra resource allows one process to acquire its second instance, complete its execution, and release both instances, thereby allowing other processes to proceed.
Minimum k = (Resources in worst case) + 1 Minimum k = 5 + 1 = 6
Final Answer
The minimum value of k for the system to be deadlock-free is 6.