The Deadly Embrace

Deadlock (which is sometimes called the deadly embrace) is another crippling condition. It occurs when two or more programs are each waiting for the others to complete - or even just to produce a data value - before proceeding.

The programs act like the overly congenial gophers in some Looney Tunes cartoons:

"Oh please, you first," says one.

"No no, I insist, you first," says the other. And nothing goes anywhere.

Generally, deadlock occurs in systems that run multiple tasks or in servers with multiple clients. Operating systems and middleware that queues messages have attempted to eradicate deadlock, but it still pops up now and then.

There's a historic reason why deadlock exists.

Early operating systems ran only one program at a time, and all of the resources in the system were automatically made available to that one program.

In order to run multiple programs at once, programmers figured out how to start fulfilling a program's needs without giving it the system's full resources. In midoperation, a program can request additional resources as it needs them. But if the resources it needs have already been grabbed by another program or programs, the result is deadlock.

Beyond operating systems, deadlock can occur in databases and Web browsers. Generally, deadlock happens less often in newer applications because new hierarchies for requests are able to skirt around the problem in many cases.

Read accompanying story:

Copyright © 2001 IDG Communications, Inc.

Bing’s AI chatbot came to work for me. I had to fire it.
Shop Tech Products at Amazon