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

Suppose we use the Banker\'s Algorithm to avoid deadlock. Consider a system that

ID: 3902622 • Letter: S

Question

Suppose we use the Banker's Algorithm to avoid deadlock. Consider a system that has 5 processes P1, P2, P3, P4, P5 and four types of resources a, b, c and d; it has 6 units of a, 3 units of b, 4 units of c, 2 units of d.

The matrix EXISTING[] denotes the existing resource units and is always ( 6 3 4 2 ). Matrix POSSESSED[] denotes the resource units held by the processes; AVAILABLE[] denotes the units available for allocation; ALLOCATED[] denotes the units that have been allocated to the processes; NEED[] denotes the units that may still be needed by the processes to complete the tasks.

Suppose at a certain state the matrices are as shown below.

Which of the following is the correct AVAILABLE matrix?


A. (1, 1, 0, 0 )
B. ( 1, 1, 1, 1 )
C. ( 6, 3, 4, 2 )
D. ( 5, 2, 3, 1 )
E. ( 5, 5, 3, 3 )

ALLOCATED= 2 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 0 1 0 NEED = 1 1 0 1 0 1 1 1 2 0 1 0 1 2 1 0 1 1 0 0

Explanation / Answer

B. ( 1, 1, 1, 1 )

Explanation:

Available instances of resource R = Total instances of Resource R - Total allocated instances of resource R

for resource a : available = 6 - (2+0+1+1+1) = 1

for resource b : available = 3 - (0+1+0+1+0) = 1

for resource c : available = 4 - (1+0+1+0+1) = 1

for resource d : available = 2 - (0+1+0+0+0) = 1