0% found this document useful (0 votes)
29 views2 pages

Tutorial Sheet 2 Deadlocks

The document outlines a tutorial plan for a course on Operating Systems, detailing the course coordinators, branch, semester, subject code, and session. It includes a tutorial sheet with questions related to deadlocks and the Banker's algorithm, requiring students to analyze system states, resource allocation, and process completion sequences. Multiple scenarios are presented for students to determine safe states and the feasibility of resource requests.

Uploaded by

Tarandeep Kaur
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)
29 views2 pages

Tutorial Sheet 2 Deadlocks

The document outlines a tutorial plan for a course on Operating Systems, detailing the course coordinators, branch, semester, subject code, and session. It includes a tutorial sheet with questions related to deadlocks and the Banker's algorithm, requiring students to analyze system states, resource allocation, and process completion sequences. Multiple scenarios are presented for students to determine safe states and the feasibility of resource requests.

Uploaded by

Tarandeep Kaur
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/ 2

TUTORIAL PLAN

Name of the Course-Coordinator: Prof. Amanpreet Singh Brar


Dr. Daljit Singh
Prof. Harkomalpreet Kaur
Prof. Kamaljeet Kaur

Branch Semester Subject Code Session


CSE 4th Operating Systems PCCS-105 Jan.-June 2025

Tutorial Sheet No. 2

Deadlocks: Introduction to deadlocks, Conditions for deadlock, Resource allocation graphs,


Deadlock prevention and avoidance, Deadlock detection and recovery.

Q1. Suppose that the system is having 12 tape drives. At current time situation is:-
Process Maximum Needs Current Needs
P0 10 5
P1 4 2
P2 9 2
Answer the following questions using the banker’s algorithm:
a. Illustrate that the system is in a safe state and what is safe sequence?
b. If process P2 request one for tape drive then safe sequence exist or not?

Q2. Consider the following snapshot of a system:


Allocation Max Available
A B C D A B C D A B C D
P0 2 0 0 1 4 2 1 2 3 3 2 1
P1 3 1 2 1 5 2 5 2
P2 2 1 0 3 2 3 1 6
P3 1 3 1 2 1 4 2 4
P4 1 4 3 2 3 6 6 5
Answer the following questions using the banker’s algorithm:
a. Illustrate that the system is in a safe state by demonstrating an order in which the
processes may complete.
b. If a request from process P1 arrives for (1,1,0,0), Can the request be granted immediately?
c. If a request from process P4 arrives for (0,0,2,0), Can the request be granted immediately?

Q3. Consider the following snapshot of a system:


Allocation Max
A B C D A B C D
P0 3 0 1 4 5 1 1 7
P1 2 2 1 0 3 2 1 1
P2 3 1 2 1 3 3 2 1
P3 0 5 1 0 4 6 1 2
P4 4 2 1 2 6 3 2 5
Using the banker’s algorithm, determine whether or not each of the following states is unsafe. If
the state is safe, illustrate the order in which the processes may complete. Otherwise, illustrate
why the state is unsafe.
a. Available = (0,3,0,1)
b. Available = (1,0,0,2)

Q4. Consider the following snapshot of a system:


Allocation Max Available
A B C A B C A B C
P0 0 1 0 7 5 3 3 3 2
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 2 2 2
P4 0 0 2 4 3 3
Answer the following questions using the banker’s algorithm:
a. Illustrate that the system is in a safe state by demonstrating an order in which the
processes may complete.
b. If a request from process P1 arrives for (1,0,2), Can the request be granted immediately?
c. If a request from process P4 arrives for (3,3,0), Can the request be granted immediately?
d. If a request from process P2 arrives for (0,2,0), Can the request be granted immediately?

Q5. Consider the following snapshot of a system:


Using Banker’s algorithm
Allocation Request Available
A B C A B C A B C
P0 0 1 0 0 0 0 3 3 2
P1 2 0 0 2 0 2
P2 3 0 3 0 0 0
P3 2 1 1 1 0 0
P4 0 0 2 0 0 2
Is the system in a safe state?

You might also like