Fall 2021 - CS604 - 3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Operating System (CS604) Total marks = 20

Assignment # 03 Deadline Date

Fall 2021 16/02/2022

Please carefully read the following instructions before attempting the assignment.

RULES FOR MARKING


It should be clear that your assignment would not get any credit if:
 The assignment is submitted after the due date.
 The submitted assignment does not open or the file is corrupt.
 Strict action will be taken if the submitted solution is copied from any other student or the
internet.

You are supposed to submit your assignment in Doc or Docx format.


Any other formats like scan images, PDF, Zip, Rar, Ppt, and Bmp, etc will not be accepted.

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.

For any query, feel free to email at:


CS604@vu.edu.pk
Question No. 1 15 Marks

Q1. Suppose following number of processes along with resources instance currently running
in a system.

 P= { P1, P2, P3, P4, P5}


 R = { R1, R2, R3, R4, R5 }

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.

Considering the above system states

You are required to draw the Resource Allocation Graph and state that either system is in
safe state or not. Briefly justify your answer.

Question No. 2 05 Marks


Suppose a system with 18 tape drives and 4 processes. The current system state is shown in
the following table.

Process Max Need Allocated Available


P0 13 5 2
P1 8 6
P2 16 2
P3 18 3

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.

You might also like