Professional Documents
Culture Documents
Fall 2021 - CS604 - 3
Fall 2021 - CS604 - 3
Fall 2021 - CS604 - 3
Please carefully read the following instructions before attempting the assignment.
OBJECTIVE
The objective of this assignment is to provide hands-on experience of:
Bounded buffer problem
Semaphores
High-level Synchronization Constructs
Safety Algorithm
Deadlock Avoidance.
NOTE
Assignement No. 3 covers 23-27 lectures. No assignment will be accepted after the due date via
email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence
refrain from uploading assignments in the last hour of the deadline. It is recommended to upload
the solution file at least two days before its closing date.
If you find any mistake or confusion in the assignment (Question statement), please consult with
your instructor before the deadline. After the deadline, no queries will be entertained in this
regard.
Q1. Suppose following number of processes along with resources instance currently running
in a system.
Resource Instances
2 instance of resource type R1
2 instances of resource type R2
1 instance of resource type R3
1 instance of resource type R4
1 instance of resource type R5
Process States
Process P1 is holding 1 instance of resource R1, and is waiting for an instance of
resource R2.
Process P2 is holding an instance of resource R2 and R3, and is waiting for an
instance of resource R4.
Process P3 is holding 1 instance of resource R2 and waiting for an instance of
resource R1 and R5.
Process P4 is holding 1 instance of resource R5 and R1, and also waiting for an
instance of resource R3.
Process P5 is holding 1 instance of R4 and waiting for for an instance of resource R1.
You are required to draw the Resource Allocation Graph and state that either system is in
safe state or not. Briefly justify your answer.
A. By using the deadlock avoidance algorithm to find out that either the system is in a
safe state or not, when considering the request of all processes. Fill the Available
column in given table.
B. If the system is in a safe state, then write down the safe sequence and if the system is
not in a safe state, then give a reason to support your answer.