Question

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

Homework Answers

Answer #1

Solution:

Given data

Process Has Maximum Needed Remaining Needs After Allocation
P1 2 4 4-2=2
P2 2 7 7-2=5
P3 3 9 9-3=6

Here we know that total number of resources available are 10

So Total number of resources which are free = total resources - sum(allocated resources)

i.e Available resources = 10 - (2+2+3) = 3

Available Resources
3

Here available resources are 3.

For avoiding deadlock we need to allocate the resources whose needs are meeting with the available resources.

So from the given processes P1 requires 2 resources,P2 requires 5 resources where as P3 requires 6 resources.

Here available resources are 3 so we can allot the 2 resources needed for process P1.

i.e

Available Resources after alloting to process P1
3-2=1

Now assume process p1 has completed that means it will relase all its resouces i.e 4 will be added to available resources.

Available Resources after completion of P1
Prev Available + P1 releases resources = 1 + 4 = 5

Now we have available resources as 5. Since P1 is completed the remaining processes are P2,P3 which requires 5 and 6 resources to complete the execution.

Here process P2 requires 5 resources and the available resources also 5 so we can allot those resources to process P2.

i.e

Available Resources after alloting to process P2
5 - 5 = 0

Now P2 has all needed resources so it will complete its execution and will release the resources it has i.e 7.

Available Resources after completion of P2
Prev Available + P2 releases resources = 0 + 7 = 7

Till now P1,P2 are executed safely without any deadlock.

Now the final remaining process is P3 which requires 6 more resources to execute . Here available resources are 7 so assign 6 resources to process P3.

Available Resources after alloting to process P3
7 - 6 =1

Since all needed resources allocated P3 will completer its execution and releases the resources.

Available Resources after completion of P3
Prev Available + P3 releases resources = 1 + 9 = 10

Final Available resources after completion of all processes should equal to total instance of resources i.e 10

Available Resources after completion of All processes
10

Here P1,P2,P3 executed without any deadlock. So the system is in safe state and the safe sequence is P1,P2,P3.

Note: if you have any queries please post a comment thanks a lot... always available to help you....

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
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
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
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...
Efficient Allocations for Depletable Resources n = 2 time periods. Inverse Demand Curves: P1 = 10...
Efficient Allocations for Depletable Resources n = 2 time periods. Inverse Demand Curves: P1 = 10 - 0.4q1 for period 1 and P2 = 10 - 0.4q2 for period 2. Marginal Costs for the two periods:   MC1 = $3.00   MC2 = $3.00 Discount rate = 15% Resource Availability Constraint:   Q = q1 + q2 = 25 billion units. Calculate the dynamically efficient allocations q1* and q2* for periods 1 and 2. Dynamic efficiency condition MNB1 = λ = PV MNB2...
Answer Questions 2 and 3 based on the following LP problem. Let     P1 = number of...
Answer Questions 2 and 3 based on the following LP problem. Let     P1 = number of Product 1 to be produced           P2 = number of Product 2 to be produced           P3 = number of Product 3 to be produced Maximize 100P1 + 120P2 + 90P3         Total profit Subject to         8P1 + 12P2 + 10P3 ≤ 7280       Production budget constraint             4P1 + 3P2 + 2P3 ≤ 1920       Labor hours constraint                                    P1 > 200         Minimum quantity needed...
Be appreciated if you can solve this problem to me. Following are the number of years...
Be appreciated if you can solve this problem to me. Following are the number of years of service for 40 employees in a company. The CEO wants to pick a sample of 10 to determine the average number of year of service. Using the systematic random sampling pick out the sample of 10 starting with any point from the first column. 11 4 18 2 1 2 0 2 2 4 3 4 1 2 2 3 3 19 8...
Four Step Process with Rework and Scrap Consider the following four step assembly operation with quality...
Four Step Process with Rework and Scrap Consider the following four step assembly operation with quality problems. All resources are staffed with one operator. -The first resource has a processing time of 4 minutes per unit -The second resource has a processing time of 3 minutes per unit. This process suffers from a high yield loss and 50% of all products have to be scrapped after this step. -The third resource also suffers from quality problems. However, instead of scrapping...
utility function u(x,y) = x3 ·y2 I am going to walk you through the process of...
utility function u(x,y) = x3 ·y2 I am going to walk you through the process of deriving the optimal quantity of apples and bananas that will make you the happiest. To do this, we are going to apply what we learnt about derivatives. a) First, you have a budget. You cannot just buy an infinite amount since you would not be able to afford it. Suppose the price of a single apple is Px = 2 while the price of...
For each part labeled P(n), there is a warning/error/problem that goes with it. Write down what...
For each part labeled P(n), there is a warning/error/problem that goes with it. Write down what the issue was in the `Error:` section of each problem. And fix the code to make it work. // P0 #include <stdio.h> #include <stdlib.h> /* Error: */ void fib(int* A, int n); int main(int argc, char *argv[]) { int buf[10]; unsigned int i; char *str; char *printThisOne; char *word; int *integers; int foo; int *bar; char *someText; // P1 for (i = 0; i...
The following table shows​ William's total utility from consuming Pita Wraps and Bubble Tea. Pita Wraps...
The following table shows​ William's total utility from consuming Pita Wraps and Bubble Tea. Pita Wraps Bubble Tea Quantity Total Utility 1 72 2 156 3 222 4 276 5 318 6 354 7 378 8 396 9 405 10 411 11 414 12 414 Quantity Total Utility 1 60 2 126 3 180 4 230 5 276 6 318 7 354 8 372 9 381 10 387 11 390 12 390 Suppose William has​ $30 to spend on Pita...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT