To guarantee that the system is deadlock-free, the total number of resource instances k must be strictly greater than the maximum number of resources that can be allocated without any single process completing its maximum demand.
Given:
Number of processes N=5
Maximum demand of each process Mi=2 for all i∈{1,2,…,5}
In the worst-case allocation scenario, each process is allocated one less than its maximum demand:
Allocated instances per process=Mi−1=2−1=1 The total number of instances allocated in this worst-case state is:
i=1∑N(Mi−1)=5×1=5 To ensure at least one process gets its remaining requested instance, completes execution, and releases all its resources, we need at least 1 additional resource instance:
k≥i=1∑N(Mi−1)+1=5+1=6 Thus, the minimum value of k for the system to be deadlock-free is 6.