21 views

## But As clearly mentioned in the Galvin Book:

A state is safe if the system can allocate resources to each process (up to its maximum) in some order and still avoid a deadlock. More formally! a system is in a safe state only if there exists a safe sequence. A sequence of processes < PI! P2! ...! PI/> is a safe sequence for the current allocation state it for each Pi! the resource requests that Pi can still make can be satisfied by the currently available resources plus the resources heldby all Pi, withj < i.

From this definition i can solve like this:

Let us take 11 processes i.e. P1, P2, ……...P11. now we allocate 2 resources to each process. Now total 22 resources are allocated to these process and we left with 8 resources now With these 8 resources we can easily get a safe sequence satisfy the need of all the process as :

## Safe sequence : P1,P2……...P11.

Hence system is still in safe state. So I think answer should be 11. Please correct me if i am wrong?

| 21 views

+1 vote

(Max need -1 ) * N +1 <= R

$3*N +1 <= 30$

$3N <= 29$

$N <= 9$

$8$ resources and each process wants $2$ resource more to complete.

What if now each process is alloted $1$ resource and $1$ is still left to allot

i.e. P1 to P8 have $3$ resources each and P9 to P11 have $2$ resource each.

deadlock occured since now resources are over and all processes are still waiting for getting the resource.

In question when they ask safe state it means that there should not be any possibility of deadlock in any manner.

by (4.1k points)