trace the deadlock detection algorithmfor the following snapshaot of the systemand answer the following question
Answers
Answer:
Deadlocks
Practice Exercises
7.1 List three examples of deadlocks that are not related to a computer-
system environment.
Answer:
• Two cars crossing a single-lane bridge from opposite directions.
• A person going down a ladder while another person is climbing up
the ladder.
• Two trains traveling toward each other on the same track.
7.2 Suppose that a system is in an unsafe state. Show that it is possible for
the processes to complete their execution without entering a deadlock
state.
Answer:
An unsafe state may not necessarily lead to deadlock, it just means that
we cannot guarantee that deadlock will not occur. Thus, it is possible
that a system in an unsafe state may still allow all processes to complete
without deadlock occurring. Consider the situation where a system has
12 resources allocated among processes P0, P1, and P2. The resources are
allocated according to the following policy:
Max Current Need
P0 10 5 5
P1 4 2 2
P2 9 3 6
Currently there are two resources available. This system is in an
unsafe state as process P1 could complete, thereby freeing a total of
four resources. But we cannot guarantee that processes P0 and P2 can
complete. However, it is possible that a process may release resources
before requesting any further. For example, process P2 could release a
resource, thereby increasing the total number of resources to five. This
19