View worked solution
Answer: 2
To ensure that a system is always free from deadlock, the total number of resources allocated in the worst-case scenario (where every process is holding one less than its maximum requirement) must be strictly less than the total available resources.
Let:
- (Number of processes)
- (Total instances of the resource)
- Maximum demand of each process
In the worst-case state, each of the processes holds resources and is waiting for one more resource. For a deadlock to be avoided, the total resources allocated in this state must be less than the total available resources :
Substituting the given values:
Since the maximum demand must be an integer, the largest integer value of that always avoids deadlock is .
Verification:
- If : The worst-case allocation is when each of the processes holds resource (total allocated). Since resource remains free (), any of the processes can acquire it, complete its execution, and release its resources. Thus, deadlock is impossible.
- If : The processes could hold , , and resources respectively (total allocated, free). Each process needs at least more resource to finish, resulting in a deadlock.
Free practice · Your answers on this page are not saved.
