2,164 views
Consider a system which has $28$ instances of a resource $P$ such that $4+n$ processes share them,$4$ process request $5$ instances of $'P'.$ If $n$ process request $5$ instances of same resources what is the maximum value of $n$ such that system is in safe state______

2?

@Lakshman Patel RJIT please check.. let me know in case of any clarification

Given : Total Resources: 28

Total no of processes : 4+n

Out of this 4 process require 5 resources and n require 5. So For the minimum no of processes for which deadlock occurs we will take away 1  resource from each of the process. So total 4 processes have 4 resources each and n have 4.

So that means 4*4+4*n=28 for deadlock so for deadlock minimum val of n is n=(28-16)/4=3

This causes deadlock. So for system to be deadlock free maximum value of n is = 3-1=2. This is because this value of n will not lead to any deadlock 3 would. So we first calculate the  value for minimum value which causes deadlock and then subtract 1 for max value which wont cause deadlock.

more accurate $5(n-1)+1\leq 3$ for deadlock free

I also did same, but i mark the answer as $2$, which is wrong.

thanks to you

As we know

here total no of resources=28

total no of process=4+n

total demand=20+5n

total no of resources+total no of process>total demand

28+4+n>5n+20

32+n>5n+20

32-20>5n-n

12>4n

3>n

min no process that ensure deadlock=3

maximum no process that ensure no deadlock=3-1=2