Sei sulla pagina 1di 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.

Potrebbero piacerti anche