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

Answer Assignment 3

The document contains the steps to solve an assignment using Banker's Algorithm. It includes: 1) Calculating the need matrix showing the resource needs for 5 processes; 2) Confirming the system is in a safe state with the current available resources; 3) Attempting to allocate one additional instance of resource RA to process P0 and showing the system would not remain in a safe state.

Uploaded by

beter
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views

Answer Assignment 3

The document contains the steps to solve an assignment using Banker's Algorithm. It includes: 1) Calculating the need matrix showing the resource needs for 5 processes; 2) Confirming the system is in a safe state with the current available resources; 3) Attempting to allocate one additional instance of resource RA to process P0 and showing the system would not remain in a safe state.

Uploaded by

beter
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Answer assignment 3:

Questions

a) Calculate the Need matrix:


The need matrix is:

p0
p1
p2
p3
p4

RA
2
0
1
0
2

need
RB
2
1
1
3
0

RC
0
3
0
2
0

RD
3
1
2
0
3

b) Is the system in safe state?


The available now (R) is: 1, 2, 2, 2
Yes, the system is in safe state, and this is the safe order that satisfy safety
requirement:
R=
R after
p2 =
R after
p0 =
R after
p1 =
R after
p3 =
R after
p4 =

c) can one instance of RA by process P0 be granted safely


according to Bankers Algorithm?
Check P0 request (1, 0, 0, 0) Available now (1, 2, 2, 2)? Yes.
Available now (R) is: 0, 2, 2, 2
Allocation matrix:

P0
P1
P2

Current Allocation
RA
RB
RC
2
0
1
0
1
2
4
0
0

RD
1
1
3

P3
P4

1
1

2
0

1
3

0
0

p0
p1
p2
p3
p4

RA
1
0
1
0
2

need
RB
2
1
1
3
0

RC
0
3
0
2
0

RD
3
1
2
0
3

R=

Need matrix:

The system is not safe.

You might also like