P

PrepStack

Deadlocks

A deadlock is a standstill: several threads (separate lines of work inside one program) each hold something and each wait for something another one holds, so none can move. Interviewers ask you to name the four conditions, tell the ways to handle it apart, and run the Banker's algorithm (a method that checks, before granting a request, that everyone can still finish) on a small table. The examples use made-up numbers unless a source is named.

After this section you can state the four conditions, say which one each prevention method breaks, find a safe sequence by hand, and explain how deadlock differs from starvation and livelock.

Topics in this section