0% found this document useful (0 votes)
123 views1 page

CS2106 Tutorial 6

This document contains 5 questions related to deadlock conditions in computing systems. Question 1 discusses how the 4 conditions for deadlock are necessary but not sufficient if there can be more than one copy of each resource type. It asks for an example to show no deadlock even if conditions are met. Question 2 asks if only processes in a resource allocation graph cycle can experience deadlock. Question 3 asks for the minimum value of x to make 3 processes deadlock-free given their allocated/requested resources. Question 4 discusses an unfair preemption solution to the dining philosophers problem and asks how to improve fairness. Question 5 asks about necessary and sufficient conditions for deadlock with multiple copies of resources.

Uploaded by

weitsang
Copyright
© Attribution Non-Commercial (BY-NC)
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)
123 views1 page

CS2106 Tutorial 6

This document contains 5 questions related to deadlock conditions in computing systems. Question 1 discusses how the 4 conditions for deadlock are necessary but not sufficient if there can be more than one copy of each resource type. It asks for an example to show no deadlock even if conditions are met. Question 2 asks if only processes in a resource allocation graph cycle can experience deadlock. Question 3 asks for the minimum value of x to make 3 processes deadlock-free given their allocated/requested resources. Question 4 discusses an unfair preemption solution to the dining philosophers problem and asks how to improve fairness. Question 5 asks about necessary and sufficient conditions for deadlock with multiple copies of resources.

Uploaded by

weitsang
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 1

National University of Singapore

School of Computing
CS2106 Tutorial 6 Semester 1 10/11

1. The four conditions for deadlock: mutual exclusion, hold and wait, no preemption, and
circular waiting are both sufficient and necessary for deadlock if there are one copy of each
resource type.
If there can be more than one copy of each resource type, however, the four conditions
are necessary but not sufficient for deadlock. In other words, it is possible that the four
conditions hold, but there is no deadlock.
Construct an example using three processes A, B, C, and two resource types R and S (with
one copy of R and two copies of S) to show that there can be no deadlock even if the four
conditions for deadlock hold.

2. Consider the case where each resource type has only one copy. Is the following statement
correct?
“Only processes that are part of a cycle in a resource allocation graph are in a deadlock.”

3. Consider the following snapshot of a system’s states, with three processes and five allocat-
able resources. The current allocated and requested resources are as follows:
Available
00x11
Allocated Requested
Process A 20110 02100
Process B 11010 10300
Process C 11110 00111
What is the minimum value of x in order for the processes to be deadlock-free?

4. A non-deadlock solution to the dining philosopher problem is to allow preemption of chop-


sticks. If a more senior philosopher Ps is waiting for a chopstick that is being used by a
junior philosopher Pj , Ps can pull rank on Pj and preempt the chopstick from Pj . Pj has
to pass the chopstick to Ps so that Ps can eat while Pj waits.
This scheme is obviously unfair to a junior philosopher if he happens to sit between two
senior philosophers, as he gets to eat less often than his senior colleagues.
Suggest a improvement to the above preemption-based solution to the dining phisopher
problem to improve the fairness among the philosophers.

5. (?) What are the necessary and sufficient conditions for deadlock if there can be more than
one copy of each resource type? (Hint: Extend the circular waiting condition).

You might also like