Sheet7 2024
Sheet7 2024
Sheet7 2024
1. Draw a joint progress diagram that may cause a deadlock for one of its progress paths and show a
progress path that will cause the deadlock.
Draw another joint progress diagram that is deadlock-free for all of its progress paths.
2. What are the 3 common approaches that can deal with all types of deadlock?
3. In the code below, three processes compete for six resources labeled A to F.
a. Using a resource allocation graph, show the possibility of a deadlock in this
implementation.
4. Modify the order of some of the get requests in the previous question to prevent the
possibility of any deadlock. You cannot move requests across procedures, only change the
order inside each procedure. Use a resource allocation graph to justify your answer.
Page 1
6.3 DEADLOCK AVOIDANCE
5. Consider a system with a total of 150 units of memory, allocated to three processes as shown below:
Apply the banker’s algorithm to determine whether it would be safe to grant each of the following
requests. If yes, indicate a sequence of terminations that could be guaranteed possible. If no, show
the reduction of the resulting allocation table.
a. A fourth process arrives, with a maximum memory need of 60 and an initial need of 25 units.
b. A fourth process arrives, with a maximum memory need of 60 and an initial need of 35 units.
6. Apply the deadlock detection algorithm to the following data and show the results.
7. Consider a system consisting of four processes and a single resource. The current state of the claim
and allocation matrices are as follows:
What is the minimum number of units of the resource needed to be available for this state to be
safe?
Page 2
6.5 AN INTEGRATED DEADLOCK STRATEGY
8. Consider the following ways of handling deadlock: (1) banker’s algorithm, (2) detect deadlock and kill
the thread, releasing all resources, (3) reserve all resources in advance, (4) restart thread and release
all resources if the thread needs to wait, (5) resource ordering, and (6) detect deadlock and roll back
thread’s actions.
GENERAL QUESTIONS
10. Consider the following snapshot of a system. There are no outstanding unsatisfied requests for
resources.
Page 3
a. Compute what each process still might request and display in the columns labeled “still
needs”
b. Is this system currently in a safe or unsafe state? Why?
c. Is this system currently deadlocked? Why or why not?
d. Which processes, if any, are or may become deadlocked?
e. If a request from p3 arrives for (0, 1, 0, 0), can that request be safely granted immediately?
Which processes, if any, are or may become deadlocked if this whole request is granted
immediately?
Page 4