CS2106 Tutorial 6
CS2106 Tutorial 6
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?
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).