You are on page 1of 2

ASSIGNMENT: Quiz3

Name: Krishna Sagar Biradawada


Id: 1005541

Answers:
A.
Given, allocation and max matrices, we have to calculate the need matrix.
NEED MATRIX = MAX MATRIX ALLOCATION MATRIX.

MAX
P
0
P
1
P
2
P
3
P
4

A B C D
0 0 2 2
1 7 5 0
2 3 5 6
0 6 5 2
0 6 5 6

ALLOCA
TION
P
0
P
1
P
2
P
3
P
4

A B C D
0 0 1 2
1 0 0 0
1 3 5 4
0 6 3 2
0 0 1 4

||

NEED
P
0

A B C D
0 0 1 0

P
1
P
2
P
3
P
4

0 7 5 0
1 0 0 2
0 0 2 0
0 6 4 2

B.
No, the system is not safe.

Why?
Start the execution of process p0, it needs one more unit of C to complete the
execution, as the resources are available P0 will complete the execution
successfully.
Now P1 begins to execute, we have available as follows
ABCD
0532
But p1 needs,
0 7 5 0 to complete the process, as other process would not release the
resources until they execute, this results in deadlock.

C.
No, the request cannot be granted immediately.

Why?
If the request is granted the new state is not safe.
P0 requires 1unit of C to complete the execution, If the above request is granted
then there are no Cs left to execute the P0 which is unsafe. So the request is not
granted immediately.

You might also like