Most non-trivial applications involve high degrees of concurrency and many
layers of abstraction. Concurrency is associated with resource contention and
an increase in deadlock conditions. The multiple layers of abstraction make
it more difficult to isolate and fix the deadlock conditions.
Generally, a deadlock happens when two or more concurrent threads of
execution each hold a resource and request another resource. Since neither
one continues until it acquires the resource, we say each specific thread is
blocked; if each thread is blocked on a resource that is held by another
thread in the same group, we say the group of threads is deadlocked.
In this article, we'll discuss two broad categories of deadlocks that occur
in typical non-trivial J2EE applications: "simple" database deadlocks and
cross-resource deadlocks. Although the discussion is based on J2EE, it also ... (more)