Question

Part B (10) Deadlock Avoidance Consider the following maximum-claim reusable resource system with four processes and three re

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Consider processes as P0, P1, P2, P3, and resources as R0, R1, R2.

Given 2 Matrices Maximum Matrix C which shows the maximum number of resources of each type required by each process during its execution and the Allocation matrix A shows the current number of resources of each type allocated to each process

Resources available are [R0 R1 R2]=[5 8 15]

Need Matrix=Maximum Matrix-Allocation Matrix

Now we have,

Maximum Matrix ( C) Allocation Matrix (A) Need Matrix
R0 R1 R2 R0 R1 R2 R0 R1 R2
P0 4 1 4 0 1 4 4 0 0
P1 3 1 4 2 0 1 1 1 3
P2 5 6 13 1 2 1 4 4 12
P3 1 1 6 1 0 3 0 1 3

and by the mentioned in the question, the system is in a safe state for now.

The processes and resources are indexed from 0.

Checking whether a request by process p1 for 2 units of resource 2 can be safely granted or not:

P1 requests [R0 R1 R2]=[0 0 2] i.e., process 1 requests 2 units of resource 2.

Available Resources [R0 R1 R2]=[5 8 15]

Clearly,

The instances available currently, the requirements or requests of process1 P1 can be satisfied.

So Bankers algorithm assumes that the request from process 1 is entertained and then it modifies the matrix as

Note: Modified data is represented in Bold

Maximum Matrix ( C) Allocation Matrix (A) Need Matrix
R0 R1 R2 R0 R1 R2 R0 R1 R2
P0 4 1 4 0 1 4 4 0 0
P1 3 1 4 2 0 3 1 1 1
P2 5 6 13 1 2 1 4 4 12
P3 1 1 6 1 0 3 0 1 3

Now Available resources are

[5 8 15] - [0 0 2] = [5 8 13]

Now, it follows the safety algorithm to check whether this resulting state is a safe state or not.

if it is a safe state, then the request can be safely permitted otherwise not.

Step 1:

  • With the instances available currently, the requirement of the process P0 can be satisfied.
  • So, process P0 is allocated to the requested resources.
  • It completes its execution and then frees up the instances of resources held by it.

Then available instances are

= [5 8 13] + [0 1 4]

= [5 9 17]

Step 2:

  • With the instances available currently, the requirement of the process P1 can be satisfied.
  • So, process P1 is allocated to the requested resources.
  • It completes its execution and then frees up the instances of resources held by it.

Then available instances are

= [5 9 17] + [2 0 3]

= [7 9 20]

Step 3:

  • With the instances available currently, the requirement of the process P2 can be satisfied.
  • So, process P2 is allocated to the requested resources.
  • It completes its execution and then frees up the instances of resources held by it.

Then available instances are

= [7 9 20] + [1 2 1]

= [8 11 21]

Step 4:

  • With the instances available currently, the requirement of the process P3 can be satisfied.
  • So, process P3 is allocated to the requested resources.
  • It completes its execution and then frees up the instances of resources held by it.

Then available instances are

= [8 11 21] + [1 0 3]

= [9 11 24]

Thus ,

There exists a safe sequence P0-->P1-->p2-->P3 in which all processes are executed.

So,The system is in a safe state.

Thus, The request by process 1 can be safely granted.

Add a comment
Know the answer?
Add Answer to:
Part B (10) Deadlock Avoidance Consider the following maximum-claim reusable resource system with four processes and...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • a. A system has two processes and three identical resources. Each process needs a maximum of...

    a. A system has two processes and three identical resources. Each process needs a maximum of two resources. Is deadlock possible? Explain your answer. b. A system has 4 processes, P1 through P4, and 5 types of resources, R1 through R5. Existing resource vector E = (3, 2, 1, 2, 2) Current allocation matrix C = R1 R2 R3 R4 R5 P1 1 1 0 0 0 P2 0 0 1 0 0 P2 1 0 0 20 P4 0...

  • resource instances of the same type, being shared by processes maz, is maximum resource needs of...

    resource instances of the same type, being shared by processes maz, is maximum resource needs of Pi, where 2 mar, S m n. Assume that a process can request one resource at a time during execution. Answer 7. (20 pts) Consider a system of m P, P Pa where m 22. Suppose the following questions about deadlock among the various processes A: Suppose m 5 printers and n 2 processes in a system, with mazi 3 and mar2 4. Identify...

  • A system has five processes P1 through P5 and four resource types R1 through R4. There...

    A system has five processes P1 through P5 and four resource types R1 through R4. There are 2 units of each resource type. Given that: P1 holds 1 unit of R1 and requests 1 unit of R4 P2 holds 1 unit of R3 and requests 1 unit of R2 P3 holds one unit of R2 and requests 1 unit of R3 P4 requests 1 unit of R4 P5 holds one unit of R3 and 1 unit of R2, and requests...

  • Please give an explanation for the answers as well. 1. A system has three processes (P1,...

    Please give an explanation for the answers as well. 1. A system has three processes (P1, P2, and P3) and three resources (R1, R2, and R3). There is one instance of RI, two instances of R2, and three instances of R3. PI holds RI and one instance of R3 and is requesting one instance from R2. P2 holds one instance of R3 and is requesting RI and one instance from R2. P3 holds two instances of R2 and one instance...

  • Consider a system in which four processes (A,B,C,D) are attemptign to access four types of resource...

    Consider a system in which four processes (A,B,C,D) are attemptign to access four types of resource (1,2,3,4). There are two instances of each type of resource , and the current allocation is <1001> for A , <0101> for B , <1000> for C , and <0010> for D. The Max Need for each process is <2002> for A , <0202> for B , <1100> for C , and <1010> for D. Is this system state safe? If so give an...

  • In order to prevent deadlocks, let a system adopt the policy of forcing processes to request...

    In order to prevent deadlocks, let a system adopt the policy of forcing processes to request resources in ascending order of request type rank. In particular, when a process is requesting a resource of a certain type, the process cannot be holding other higher ranked resources. Consider four resource types with the following profile in this system: Resource Type Rank Number of Instances RT1 4 2 RT2 7 4 RT3 8 3 RT4 10 2 Let the following sequence of...

  • Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In...

    Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In this scheme, some procedure is used to identify when a deadlock occurs, and then another procedure is used to deal with the blocked processes. One technique to identify a deadlock is to maintain a resource graph that identifies all processes, all resources, and the relationships between them (that is, which processes exclusively own which resources, and which processes are blocked waiting for which...

  • Q.6. Consider a preemptive operating system where processes have priorities and a running process gets preempted...

    Q.6. Consider a preemptive operating system where processes have priorities and a running process gets preempted (i.e., forced to leave the CPU) as soon as a higher priority process is ready to run. The life cycle of a process, other than the very first process, begins with a "spawn" by another process and ends with either a regular "exit" by the process or a "terminate (process_id)" command by another process of equal or higher priority. COMP 346 – Fall 2019...

  • Please answer the following question in C++ language Consider the following set of processes, with the...

    Please answer the following question in C++ language Consider the following set of processes, with the length of the CPU burst time given in milliseconds: Process            Burst Time      Priority P1. 7 5 P2 2 4 P3 11 3 P4 9 1 P5 5 3 The processes are assumed to have arrived in the order P1,P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive...

  • Scenario: Disability Insurance Claims Handling at InsureIT We consider the following business pro...

    Scenario: Disability Insurance Claims Handling at InsureIT We consider the following business process for handling insurance claims for disability insurance[1] at an insurance company InsureIT. The process starts when a customer lodges a disability claim. To do so, the customer fills in a form including a 2-page questionnaire describing the disability. The customer can submit the form physically at one of the branches of InsureIT, by postal mail, fax or simply via e-mail (digitally-signed document). When a claim is received,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT