Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
In this note we discuss one of the most basic problems of sys-tems with complex locking protocols: deadlock. Deadlock oc-
 

Summary: 31
Deadlock
In this note we discuss one of the most basic problems of sys-
tems with complex locking protocols: deadlock. Deadlock oc-
curs, for example, when a thread (say thread 1) is holding a lock
(L1) and waiting for another one (L2); unfortunately, the thread
(thread 2) that holds lock L2 is waiting for L1 to be released.
Here is a code snippet that demonstrates such a potential dead-
lock:
Thread 1: Thread 2:
lock(L1); lock(L2);
lock(L2); lock(L1);
Note that if this code runs, deadlock does not necessarily oc-
cur; rather, it may occur, if, for example, thread 1 grabs lock
L1 and then a context switch occurs to thread 2. At that point,
thread 2 grabs L2 and we have a deadlock, as each thread de-
pends on the other to make progress. In graphical form:
holds
Thread 1 ---------------> Lock L1
^ |

  

Source: Arpaci-Dusseau, Remzi - Department of Computer Sciences, Department of Computer Sciences, University of Wisconsin at Madison

 

Collections: Computer Technologies and Information Sciences