Question

Deadlock Avoidance using Banker’s Algorithm Q1: Use the following information and complete the Table, also write...

Deadlock Avoidance using Banker’s Algorithm

Q1: 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


Homework Answers

Answer #1

Equations involved in bankers algorithm are

Need Matrix = max resources - allocated resources

Available Resources = Total resources - sum of allocated resources for each process.

If need <=available Resources , then process can be executed . After execution allocated resources are added to available Resources.

Max Matrix

Process R1 R2 R3
P1 1 0 4
P2 1 1 7
P3 1 2 2
P4 4 4 2

Available Resources.

R1 = 4-(1+2)= 1

R2=9-(4+1)=4

R3=11-(2+1+1)=7

Checking availability for P1,

1,0,4 <= 1,4,7

So P1 executes, after completion

Available Resources = 2,8,9

Checking availability for P2,

1,1,7<=2,8,9

P2 executes,

After execution available Resources = 4,9,10

Checking availability for P3,

1,2,2 <= 4,9,10

P3 executes,

After execution, available Resources = 4,9,11

Checking availability for P4,

4,4,2 <= 4,9,11

P4 executes.

Safe cycle = P1,P2,P3,p4

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What is deadlock? Draw a resource allocation graph for the following processes and resources. There are...
What is deadlock? Draw a resource allocation graph for the following processes and resources. There are four processes running (P1, P2, P3 and P4) and five resources each with single instance (R1, R2, R3, R4 and R5). P1 is holding R1 and R3 and requesting R2. P2 is holding R2 and requesting R3. P3 is holding R4 and requesting R5. P4 is holing R5 and requesting R1. Is it a deadlock situation? Justify your answer.
Q1. Solve the following problem of Deadlock avoidance. Allocate the resources such that all the process...
Q1. Solve the following problem of Deadlock avoidance. Allocate the resources such that all the process are executed safe and no deadlock is occur. Total instances of a resource=10 Process Has Maximum P1 2 4 P2 2 7 P3 3 9 Free
Q1. Solve the following problem of Deadlock avoidance. Allocate the resources such that all the process...
Q1. Solve the following problem of Deadlock avoidance. Allocate the resources such that all the process are executed safe and no deadlock is occur. Total instances of a resource=12 Process Has Maximum P1 5 10 P2 2 4 P3 2 9 Free
Consider a system with eight resources currently allocated as follows: Resource Allocated to Process R1 P4...
Consider a system with eight resources currently allocated as follows: Resource Allocated to Process R1 P4 R2 P1 R3 P5 R4 P7 R5 P2 R6 P8 R7 P3 R8 P6 The following sequence of additional resource requests is then processed. (Let REQ(A,B) denote process A's request for resource B.) REQ(P4, R2) REQ(P3, R6) REQ(P2, R1) REQ(P7, R7) REQ(P6, R1) REQ(P5, R7) The above sequence of requests do not cause a deadlock. Verify this fact by constructing a resource-allocation graph involving...
Problem 6 The following tables show the timing for processes using two different scheduling algorithms based...
Problem 6 The following tables show the timing for processes using two different scheduling algorithms based on the table of process arrival times and burst times (All ties were resolved using the arrival time). Using this information: Calculate the average turnaround time for each algorithm. Show your work. Name the scheduling algorithm used to generate the timing tables. Process Arrival Time Burst Time P1 0 4 P2 3.9 1 P3 2.9 3 P4 0.9 2 P5 1.9 4 Mystery Algorithm...
Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:...
Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process            Burst Time Priority P1                               5 4 P2                               3 1 P3                               1 2 P4                               7 2 P5                               4 3 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If nonpreemptive priority (a larger priority number implies a higher priority) is used, what is the average waiting time of...
The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm. Each process is...
The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm. Each process is assigned a numerical priority,with a higher number indicating a higher relative priority. The scheduler will execute the highest-priority process. For processes with the same priority, a round-robin scheduler will be used with a time quantum of 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue. Process            Burst Time Arrival Time...
The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm. Each process is...
The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm. Each process is assigned a numerical priority,with a higher number indicating a higher relative priority. The scheduler will execute the highest-priority process. For processes with the same priority, a round-robin scheduler will be used with a time quantum of 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue. Process            Burst Time Arrival Time...
The following processes are being scheduled using a preemptive, round-robin scheduling algorithm. (20 Marks) Process    ...
The following processes are being scheduled using a preemptive, round-robin scheduling algorithm. Process     Priority Burst Time Arrival P1 40 20 0 P2 30 25 25 P3 30 15 30 P4 35 10 60 P5 5 10 100 P6 10 10 105 Each process is assigned a numerical priority, with a higher number indicating a higher relative priority. In addition to the processes listed below, the system also has an idle task (which consumes no CPU resources and is identified...
Using the non-preemptive and preemptive Priority schedulers, draw out process execution timelines for the following processes....
Using the non-preemptive and preemptive Priority schedulers, draw out process execution timelines for the following processes. Clearly indicate the wait time for each process for each scheduler.   Process Arrival Burst Priority P1 0 6 2 P2 3 2 1 P3 6 8 4 P4 9 4 5 P5 12 3 3
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT