0% found this document useful (0 votes)
36 views3 pages

Lab6.2-Deadlocks Bankers Algorithm

Uploaded by

voluong639
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

Lab6.2-Deadlocks Bankers Algorithm

Uploaded by

voluong639
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Exersie DEADLOCK 6.

Full name: .............................................................................................................


ID: .........................................................................................................................

Q1) Given the following state for the Banker’s Algorithm. Suppose we have 3 resources (R1-
3) and 3 processes (P1-3).
R1 = Scanner
R2 = Printer
R3 = CD
Given available vector R1=2, R2 = 1, R3 = 2 Then we have the following situation:
• Snapshot at time T0:

Current Allocation Max Allocation

R1 R2 R3 R1 R2 R3

P1 0 2 0 6 5 1
P2 1 2 1 3 2 2
P3 3 0 3 5 2 3

a) Calculate the original resources

b) Calculate the Need matrix

c) Is the system in a safe state? If so, show one sequence of processes which allows the
system to complete. If not, explain why. Show your computation step-by-step.

d) Process P1 request (1,1,3). Should this request be granted? Why or why not? Show your
computation step by step

Q2) Given the following state for the Banker’s Algorithm. Suppose we have 3 resources (R1-
3) and 3 processes (P1-3).
Maximum resources R1=4, R2=5, R3=6. Then we have the following situation:
• Snapshot at time T0:
Current Allocation Request

R1 R2 R3 R1 R2 R3

P1 1 1 3 0 4 3
P2 2 1 0 1 1 1
P3 0 1 1 0 1 0

a) Calculate the available vector.

b) Calculate the Need matrix.

c) Is the system in a safe state? If so, show one sequence of processes which allows
the system to complete. If not, explain why. Show your computation step-by-step.

d) P1 need 2 more R2. Should this request be granted? Why or why not? Show your
computation step by step

Q3) A system has three processes (P1, P2, P3) and three reusable resources (R1, R2, R3).
There is one instance of R1, two instances of R2 and three instances of R3. P1 holds an R1
and an R3 and is requesting an R2. P2 holds an R3 and is requesting an R1 and an R2. P3
holds two R2 and an R3 and is requesting an R1.

a) Draw the resource allocation graph for this situation.

b) Write all the cycle(s) in the graph.

c) Does a deadlock exist? Why?

Q3)

A system has four processes and five allocatable resources. The current allocation
and maximum needs are as follows:
What is the smallest value of x for which this is a safe state?

You might also like