Question

In: Computer Science

Banker’s Algorithm

Given the following state for the Banker’s Algorithm. 

6 processes P0 through P5

4 resource types: A (15 instances); B (6 instances)

C (9 instances); D (10 instances)

Snapshot at time T0:

 

a. Verify that the Available array has been calculated correctly.

b. Calculate the Need matrix.

c. Show that the current state is safe, that is, show a safe sequence of processes. In addition, to the sequence show how the Available (working array) changes as each process terminates.

d. Given the request (3, 2, 3, 3) from Process P5. Should this request be granted? Why or why not?

Solutions

Expert Solution

a.

       15 – (2+0+4+1+1+1) = 6 

         6 – (0+1+1+0+1+0) = 3 

         9 - (2+1+0+0+0+1) = 5 

         10 – (1+1+2+1+0+1) = 4 

 

 

b.      

Need Matrix = Max Matrix – Allocation Matrix 

 

c.         

The following matrix shows the order in which the processes and shows what is available once the give process finishes) 

 

d.         

ANSWER is NO for the following reasons: IF this request were granted, then the new allocation matrix would be: 

 

Then the new need matrix would be

 

And Available is then:

 

Which means we could NOT satisfy ANY process’ need.


Which means we could NOT satisfy ANY process’ need.

Related Solutions

Implement a C++ program to implement the Banker’s algorithm for deadlock avoidance. Number of process 5,...
Implement a C++ program to implement the Banker’s algorithm for deadlock avoidance. Number of process 5, number of resources 3 and the number of instances of each given resource is in available. You should complete the functionalities for safe state check and resource request processing. To Do 1. Complete the definition of isSafe function. The function take, the process array, 1D array of available resources, 2D array storing current allocation, and 2D array of current need. The function does not...
Deadlock –Banker’s Algorithm A system has three resource types (A, B, C) and four processes {P1,...
Deadlock –Banker’s Algorithm A system has three resource types (A, B, C) and four processes {P1, P2, P3, P4 }. The total units of system resources are: (8, 5, 4) units of A, B and C, respectively. The maximum demands for each process is P1(1,2,3), P2(3,2,1), P3(6,5,4) and P4(4,4,2). The current allocation is: P1(0,1,1), P2(2,2,0) and P3(3,0,1) and P4(1,0,1). (a) Allocation table is given for the 3 processes with the following four columns: PROCESS, ALLOCATION, MAX and NEED. And fill...
Deadlock Avoidance using Banker’s Algorithm Q2: Use the following information and complete the Table, also write...
Deadlock Avoidance using Banker’s Algorithm Q2: Use the following information and complete the Table, also write down the safe sequence if exist? Three Resources (R1=4, R2=9, R3=11) Processes Allocated Resources R1   R2    R3 Maximum Required Resources R1   R2    R3 Currently Available Resources R1   R2    R3 Remaining Need R1   R2    R3 Safe Sequence P1 1      4      2 2      4      6 P2 2      1      1 3      2      8 P3 0      0      1 1      2      3 P4 0      0      0 4      4      2...
1. How numerically ordered resources method prevent deadlock using example. 1. How banker’s algorithm works on...
1. How numerically ordered resources method prevent deadlock using example. 1. How banker’s algorithm works on deadlock prevention using example
What is a Banker’s Acceptance and when/how does it become a money market instrument?
What is a Banker’s Acceptance and when/how does it become a money market instrument?
Compare and contrast documentary letter of credit with documentary collection. What is banker’s acceptance?
Compare and contrast documentary letter of credit with documentary collection. What is banker’s acceptance?
2. What the process is by which a banker’s acceptance is created? Clearly state your answer...
2. What the process is by which a banker’s acceptance is created? Clearly state your answer to each problem. Answers without justification/explanation will not be given credit
pipeline algorithm
A pipeline algorithm is implemented so that a stream of data elements of type T produced by a process P0 passes through a sequence of processes P1, P2, ., Pn - 1, which operates on the elements in that order.a. Define a generalized message buffer that contains all the partially consumed data elements and write an algorithm for process Pi (0 ≤ i ≤ n - 1), of the formrepeatreceive from predecessor;consume element;send to successor:foreverAssume P0 receives input elements sent...
bakery algorithm
Now consider a version of the bakery algorithm without the variable choosing. Then we have1 int number[n];2 while (true) {3 number[i] = 1 + getmax(number[], n);4 for (int j = 0; j < n; j++){5 while ((number[j]! = 0) && (number[j],j) < (number[i],i)) { };6 }7 /* critical section */;8 number [i] = 0;9 /* remainder */;10 }Does this version violate mutual exclusion? Explain why or why not.
A pipeline algorithm
A pipeline algorithm is implemented so that a stream of data elements of type T produced by a process P0 passes through a sequence of processes P1, P2, ., Pn - 1, which operates on the elements in that order.a. Define a generalized message buffer that contains all the partially consumed data elements and write an algorithm for process Pi (0 ≤ i ≤ n - 1), of the formrepeatreceive from predecessor;consume element;send to successor:foreverAssume P0 receives input elements sent...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT