Sheet 4
Sheet 4
Sheet 4
1. An operating system uses the banker’s algorithm for deadlock avoidance when
managing the allocation of three resource types X, Y and Z to three processes P0, P1
and P2. The table given below presents the current system state. Here, the Allocation
matrix shows the current number of resources of each type allocated to each process
and the Max matrix shows the maximum number of resources of each type required by
each process during its execution. There are 3 units of type X, 2 units of type Y and 2
units of type Z still available. The system is currently in a safe state. Consider the
following independent requests for additional resources in the current state-
A. P0
B. P1
C. P2
D. None of the above since the system is in a deadlock.
6. Consider the following snapshot of a system.
Using the banker’s algorithm, determine whether each of the following states is unsafe. If the state
is safe, illustrate the order in which the threads(processes) may complete. Otherwise, illustrate why
the state is unsafe.
a. Available = (0, 3, 0, 1)
b. Available = (1, 0, 0, 2)
8. Name the four conditions required for deadlock and give a brief (one sentence) description of
each.
9. Does a cyclic dependency always lead to deadlock? Why or why not?
10. What is the difference between deadlock prevention and deadlock avoidance? What category
does Banker’s algorithm falls in and why?