0% found this document useful (0 votes)
15 views

OS - Wipro - Lab Sheet-04

Uploaded by

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

OS - Wipro - Lab Sheet-04

Uploaded by

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

Department of Computer Science and Information Technology

Operating System: SSWTZC364/ CSIWZC364/ SEWIZC364


Lab Work Sheet-04
1. Objective:
At the end of this lab session, students will be able to:
● Understand the concept of deadlocks

● Use methods to overcome deadlock condition.

2. Prerequisite:
Refer to the “Deadlock” video capsule available in eLearn Portal’s Labware page.

3. Important Instructions:
a. Experiments should be conducted on the BITS Nuvepro Cloud Lab only.
Experiments conducted outside this lab platform will not be evaluated.
b. Instructions on how to access and use the Nuvepro Cloud lab platform are
available in the document “Steps to access cloud-based CS/IS virtual lab.pdf”.
c. While using the Nuvepro Cloud, save all your work in the Persistent folder,
which is available on the desktop. (Important Note: Always take backup of
this folder.)
d. The completed worksheet should be uploaded in Taxila (elearn) portal only.
The last date for uploading the document is 5-November-2024.
e. This worksheet/lab activity carries 2.5% of weightage
f. Refrain from copying or sharing documents with others. Any evidence of
such practice will attract severe penalties.
g. Any queries related to LAB Activities should be asked only through eLearn
portal under discussion forum. Use the below mentioned link to access the
same:
Section Discussion Forum Link

SEWIZC364 https://taxila-aws.bits-pilani.ac.in/mod/forum/discuss.php?
d=68446#p145218

SSWTZC364 https://taxila-aws.bits-pilani.ac.in/mod/forum/discuss.php?
d=68447#p145219

CSIWZC364 https://taxila-aws.bits-pilani.ac.in/mod/forum/discuss.php?
d=68448#p145220

4. Lab Exercise:
1
The lab exercise is divided in to three parts. For all the programs that is
used, the program name should begin with your <ID number>. Programs
names without your ID number will fetch zero marks.
PART-A

Consider the following 3 programs:

program P1_<ID number>


resource(1, allocate)
wait(3)
resource(2, allocate)

for n = 1 to 20
next
end

program P2_<ID number>


resource(2, allocate)
wait(3)
resource(3, allocate)

for n = 1 to 20
next
end

program P3_<ID number>


resource(3, allocate)
wait(3)
resource(4, allocate)

for n = 1 to 20
next
end
Perform / Answer the following:
Task 1: Draw the resource allocation graph for the above code.
Task 2: Compile all the above three source codes and load in the main memory at starting
addresses 100, 200, and 300 respectively. Provide the snapshot of PROGRAM SOURCE
[INPUT] and PROGRAM CODE [OUTPUT] for all the three source codes.[paste entire
compiler simulator window, after compiling each code]

2
Task 3: Create 3 processes P1, P2, and P3. Provide the evidence of process creation in the
form of snapshot.
Task 4: Select round robin scheduling algorithm and set time slice to 10 ticks. Provide the
evidence of setting in the form of snapshot.
Task 5: Start the process execution.
Task 6: Open the system resources window by pressing VIEW RESOURCES… button under
views tab. Then press SHOW DEADLOCKED PROCESSES.. button. Observe the resource
allocation graph. Present the snapshot of System resources window and resource allocation graph
at the end of the execution of processes.

PART-B

Consider a resource allocation graph with four processes and four resources.

The four processes created using the following 4 programs:

program P1_<ID number>


resource(1, allocate)
wait(3)
resource(2, allocate)

for n = 1 to 20
next
end

program P2_<ID number>


resource(2, allocate)
wait(3)
resource(3, allocate)

3
for n = 1 to 20
next
end

program P3_<ID number>


resource(3, allocate)
wait(3)
resource(4, allocate)

for n = 1 to 20
next
end

program P4_<ID number>


resource(4, allocate)
wait(3)
resource(1, allocate)

for n = 1 to 20
next
end
Perform / Answer the following:
Task 1: Compile all the above four source codes and load in the main memory at starting
addresses 100, 200, 300 and 400 respectively. Provide the snapshot of PROGRAM SOURCE
[INPUT] and PROGRAM CODE [OUTPUT] for all the four source codes. [paste entire compiler
simulator window, after compiling each code]
Task 2: Create 4 processes P1, P2, P3 and P4. Provide the evidence of process creation in the
form of snapshot.
Task 3: Select round robin scheduling algorithm and set time slice to 10 ticks. Provide the
evidence of setting in the form of snapshot.
Task 4: Start the process execution.
Task 5: Open the system resources window by pressing VIEW RESOURCES… button under
views tab. Then press SHOW DEADLOCKED PROCESSES.. button. Observe the resource
allocation graph. Is there a deadlock? Justify your answer by present the snapshot of “System
Resources Window” and resource allocation graph at the end of the execution of processes.

4
Task 6: In CPU-OS simulator, there are two of recovering from a deadlock condition after it
happens: Release resource method and release process method. Which one is better and why?

PART-C

Consider the following resource allocation graph.

Perform the following:


Task 1: Write source code for P1, P2, P3, P4 and P5. Note that name of the program should be
process number followed by ID number (For example: P1_<ID number>). Provide the snapshot
of PROGRAM SOURCE [INPUT] and PROGRAM CODE [OUTPUT] for all the five source
codes.
Task 2: Compile, load and execute all the programs. Refer Part A for procedure.
Task 3: Is there a deadlock? Justify your answer by the snapshot of “System Resources
Window” and resource allocation graph at the end of the execution of processes.

You might also like