here need matrix for all process is given below ( by (Max - allocated))
for A 0 1 0 0 2 B 0 2 1 0 0 C 1 0 3 0 0 D 0 0 1 1 1
available is 0 0 x 1 1
so only D can execute for any no of x as A,B or C need at least one instance of either of first 2 resource
if x=1 then D can be executed and will release its allocated resource which is 1 1 1 1 0 then available matrix
will become 1 1 2 2 1 but with this neither of (A,B,C ) process can be executed as their need matrix is not less than or equal to available matrix so it will result in unsafe state.
if x=2
then D can be executed and will release its allocated resource which is 1 1 1 1 0 then available matrix
will become 1 1 3 2 1 now Process C (with need 1 0 3 0 0 ) can be executed and release its allocated resources
(1 1 0 1 0 ) and then
available matrix will become 2 2 3 3 1 so B can be executed and then A (assuming some minor mistake in last resource) hence it is safe state
so ans is C x=2
Note :- process A can not be executed for any no of x as its fifth resource need is 2 which can not be fulfilled