18.2. Deadlock
A simple example of deadlock was given in Section 17.5. In that case, process P had locked object A for exclusive use and went on to request object B. Process Q had already locked object B. Deadlock occurs when process Q proceeds to request object A.
Figure 18.1 illustrates this problem. It shows the progress of processes P and Q when they are scheduled to run on a single processor, that is, only one at a time can run. Their behaviour is that each acquires one object and, while still holding it, requests the other. Paths i, j, k, l, m, n illustrate different possible dynamic behaviours of the two processes. In i and j, process P acquires both A and B before process Q requests B. In k and l, process Q acquires both B and A before ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access