0% found this document useful (0 votes)
9 views

Safety Check Algorithm

The document outlines a step-by-step process for determining the safety of a system using a Need Matrix and available resources. It demonstrates that all processes (P0, P1, P2, P3, P4) can execute safely in the sequence P0 → P2 → P1 → P3 → P4, indicating that the system is safe and free of deadlock. The final conclusion is that the system is safe with no deadlock present.

Uploaded by

iamtahereditz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Safety Check Algorithm

The document outlines a step-by-step process for determining the safety of a system using a Need Matrix and available resources. It demonstrates that all processes (P0, P1, P2, P3, P4) can execute safely in the sequence P0 → P2 → P1 → P3 → P4, indicating that the system is safe and free of deadlock. The final conclusion is that the system is safe with no deadlock present.

Uploaded by

iamtahereditz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Solution:

Step 1: Calculate Need Matrix

Need = Max − Allocation

Process Need
(A B C D)

P0 (0 0 0 0)

P1 (0 7 5 0)

P2 (1 0 0 2)

P3 (0 0 2 0)

P4 (0 6 4 2)

Step 2: Available Resources

Initially Available = (1 5 2 0)

Step 3: Check each process ( NOTE : Always select the next process whose Need ≤ Available. )

• P0: Need (0 0 0 0) ≤ Available → P0 can execute.

• After P0, Available becomes (1 5 3 2).

• P2: Need (1 0 0 2) ≤ Available → P2 can execute.

• After P2, Available becomes (2 8 8 6).

• P1: Need (0 7 5 0) ≤ Available → P1 can execute.

• After P1, Available becomes (3 8 8 6).

• P3: Need (0 0 2 0) ≤ Available → P3 can execute.

• After P3, Available becomes (3 14 11 8).

• P4: Need (0 6 4 2) ≤ Available → P4 can execute.

• After P4, Available becomes (3 14 12 12).

Hence, all processes can execute safely.

Final Answer:

System is SAFE.

Safe Sequence = (P0 → P2 → P1 → P3 → P4)

There is NO Deadlock in this system.

You might also like