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

HW6 Cse

The document contains questions for a homework assignment on operating systems deadlocks. It asks students to explain deadlock concepts, prevention and recovery techniques, and analyze different resource allocation scenarios and policies to determine if deadlock can occur.

Uploaded by

rceja674
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)
24 views3 pages

HW6 Cse

The document contains questions for a homework assignment on operating systems deadlocks. It asks students to explain deadlock concepts, prevention and recovery techniques, and analyze different resource allocation scenarios and policies to determine if deadlock can occur.

Uploaded by

rceja674
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/ 3

CSE 4600 Operating Systems

Homework Assignment 6: Deadlocks

Part I Long Answer Questions. Please provide your own responses to the
questions, using original wording, and refrain from directly copying information
from the lecture notes.

Question 1. (2 points) List three examples of deadlocks that are not related to a
computer system environment.

Question 2. (2 points) Please explain the concept of deadlock in operating systems


and explain the four necessary conditions for deadlock occurrence.

Question 3. (2 points) Please describe the strategies employed to prevent deadlock


occurrences in operating systems and provide a detailed analysis of each
prevention technique.

Question 4. (2 points) Please explain the strategies utilized to recover from


deadlock situations in operating systems and provide a detailed analysis of each
recovery technique.

Question 5. (3 points) Consider the following resource-allocation policy. Requests


for and releases of resources are allowed at any time. If a request for resources
cannot be satisfied because the resources are not available, then we check any
threads that are blocked waiting for resources. If a blocked thread has the desired
resources, then these resources are taken away from it and are given to the
requesting thread. The vector of resources for which the blocked thread is waiting
is increased to include the resources that were taken away.
For example, a system has three resource types, and the vector Available is
initialized to (4, 2, 2). If thread T0 asks for (2, 2, 1), it gets them. If T1 asks for
(1,0,1), it gets them. Then, if T0 asks for (0, 0, 1), it is blocked (resource not
available). If T2 now asks for (2, 0, 0), it gets the available one (1, 0, 0), as well as
1
one that was allocated to T0 (since T0 is blocked). T0’s Allocation vector goes
down to (1, 2, 1), and its Need vector goes up to (1, 0, 1).
Please answer the question and show the detailed analysis process: Can deadlock
occur? If you answer “yes,” give an example. If you answer “no,” specify which
necessary condition cannot occur.

Question 6. (3 points)
Consider the following snapshot of a system:

Maximum Demand Current Allocation


A B C D A B C D
T0 5 1 1 7 T0 3 0 1 4
T1 3 2 1 1 T1 2 2 1 0
T2 3 3 2 1 T2 3 1 2 1
T3 4 6 1 2 T3 0 5 1 0
T4 6 3 2 5 T4 4 2 1 2

Using the safety algorithm in 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 threads may complete. Otherwise, illustrate why the state is unsafe.
a. Available = (0, 4, 1, 1)
b. Available = (2, 0, 0, 2)

Question 7. (3 points)
Consider the following snapshot of a system:

Maximum Demand Current Allocation Available


A B C D A B C D A B C D
T0 0 0 1 2 T0 0 0 1 2 1 5 2 0
T1 1 7 5 0 T1 1 0 0 0
T2 2 3 5 6 T2 1 3 5 4
T3 0 6 5 2 T3 0 6 3 2
T4 0 6 5 6 T4 0 0 1 4

Answer the following questions using the banker's algorithm:


a. What is the content of the matrix Need?

2
b. Is the system in a safe state? If yes, illustrate the order in which the threads
may complete. Otherwise, illustrate why the state is unsafe.
c. If a request from thread T1 arrives for (0, 4, 2, 0), can the request be granted
immediately?
d. If a request from thread T4 arrives for (0, 5, 2, 0), can the request be granted
immediately?

Question 8. (3 points)
Consider the following snapshot of a system:

Current Allocation Request


A B C D A B C D
T0 3 2 1 0 T0 3 1 2 1
T1 0 2 2 1 T1 0 2 2 0
T2 3 1 0 1 T2 0 0 0 1
T3 1 3 3 2 T3 5 5 5 0
T4 3 0 3 0 T4 1 0 1 3

Using the deadlock detection algorithm determine whether or not a deadlock exists
given the following available vector. If a deadlock does not exist, please give a
safe sequence. Otherwise, illustrate which threads are deadlocked.
a. Available = (0, 0, 2, 1)
b. Available = (1, 0, 0, 1)

You might also like