Assignment 2, Question 6.

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Process Max need Allocated Available Need

A B A B A B A B
P1 2 2 1 1 1 0 1 1
P2 4 2 1 0 1 0 3 2
P3 3 2 1 0 1 0 2 2
P4 1 1 0 1 1 1 1 0
P5 6 3 2 1 1 1 4 2
Assignment 2: question 6

Available = Total resources - ∑ all process allocated.


A=6 B=3 - A=5 B=3 =10

Process Current_avail Safe string Marked


found
P4 [1 0] + [0 1] = [1 1] P4 True
P1 [1 1] + [1 1] = [2 2] P4 P1 True
P3 [2 2] + [1 0] = [3 2] P4 P1 P3 True
P2 [3 2] + [1 0] = [4 2] P4 P1 P3 P2 True
P5 [4 2] + [2 1] = [6 3] P4 P1 P3 P2 P5 True

 Safe state since all processes are marked true.


 Deadlock is prevented.

You might also like