2,165 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?
Yes, please add the answer in a detailed way, I'm confused in this question.

@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.

edited

@  In given question what are $P$ here?

P is a type of resource whose instances are given to us..

So, maximum value of $n=3-1=2$ (Safe state or no deadlock)

and the minimum number of process with deadlock(unsafe)$n=3$

I learn from your solution.

please correct me if I'm wrong$?$

ya correct

Thank you so much
edited

A system has $3$ resources and $5$ process competing for them.Each process can request a maximum of $'N'$ instances.The largest value of $N$ that will always avoid deadlock is_______$?$

@Lakshman Patel RJIT only one resource can be the maximum request for a deadlock free situation in this case.

can you explain, please?
for deadlock we assign n-1 resources to each process. So as we have 3 resources available and 5 processes so it means 5(n-1)+1=3 for no deadlock so n-1=2/5-> n=1.4 so we can have maximum 1 resource request per process
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