Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following snapshot of a system Allocation Max Available A B C D 1 4

ID: 3591382 • Letter: C

Question

Consider the following snapshot of a system Allocation Max Available A B C D 1 4 1 4 A BC D A BC D PO 1 0 0 0 P1 1 1 0 1 P2 1 1 0 1 P3 1 0 1 0 P4 01 1 0 4 2 4 1 Answer the following questions using the banker's algorithm: a Show the content of the matrix Need below Need A BC D PO P1 P2 P3 P4 b Show that the system in a safe state by listing the order in which processes can be executed without producing a deadlock If a request from process Pi arrives for (1, 0, 0, 0), can the request be granted immediately? Show the updated NEED and Allocation matrices. Ifyes, show the safe sequence. If no, list the processes that are possibly in a deadlock c

Explanation / Answer

a) Need Matrix = Max - Allocation

Need =  

b)

P2 can only be allocated resources first because all other processes require more resources. When P2 is allocated resources first, Available resources becomes:
A B C D
3 2 2 3 as P2 had holded 1 1 0 1 resources.
Now P3 can be allocated resources .
Available resources becomes:
A B C D
4 2 3 3 as P3 had holded 1 0 1 0 resources.
Now P4 can be allocated resources .
Available resources becomes:
A B C D
4 3 4 3 as P4 had holded 0 1 1 0 resources.
Now P1 can be allocated resources .
Available resources becomes:
A B C D
5 4 4 4 as P1 had holded 1 1 0 1 resources.
Now, Finally P0 can be allocated resources .
Available resources becomes:
A B C D
6 4 4 4 as P0 had holded 1 0 0 0 resources.
Hence, the order of execution is P2, P3, P4, P1 and P0 and no deadlock occurs.

c) Question is not clear whther P1 arrived after the initial condition given or in the P1 is 1 0 0 0 in Max Allocation.

A B C D P0 0 4 1 4 P1 1 3 1 1 P2 1 0 1 1 P3 1 2 2 1 P4 4 1 3 1