Deadlock Ignorance (The Ostrich Algorithm)

Deadlock ignorance, commonly called the ostrich algorithm, is the deliberate choice to do nothing about deadlocks: no prevention, avoidance or detection. It bets that the constant overhead of handling deadlocks costs more than the rare deadlock itself, which is resolved by a human rebooting the system or killing a process when it hangs.

3 min read

Deadlock ignorance, more commonly called the ostrich algorithm (after the myth that ostriches bury their heads in the sand to avoid danger), is the deliberate choice to do nothing at all about deadlocks. No prevention, no avoidance, no detection. If a deadlock happens, the system simply hangs, and a human (usually by rebooting or killing a process) has to notice and fix it.

Why anyone would choose this on purpose

Prevention, avoidance, and detection all cost something real: prevention reduces resource utilization or forces awkward upfront resource declarations, avoidance requires processes to declare maximum needs and runs a safety check on every request, and detection requires ongoing graph analysis and a recovery mechanism. For systems where deadlocks are extremely rare in practice, and the cost of an occasional hang (fixed by a reboot) is much lower than the constant overhead of guarding against something that almost never happens, ignoring the problem is a legitimate engineering tradeoff, not laziness.

A concrete illustration

Most general-purpose desktop and server operating systems, including Linux and Windows, take exactly this approach for general process/resource deadlocks. The kernel does not run a global deadlock detector across arbitrary user resources. If a user-level application deadlocks itself (two threads each waiting on a mutex the other holds, for instance), the OS does not intervene; the application simply hangs, and the fix is for a person or a watchdog process to notice and kill it.

Where this genuinely makes sense, and where it doesn't

It makes sense in general-purpose operating systems precisely because the space of possible resources and request patterns is enormous and unpredictable, running Banker's-Algorithm-style checks across every lock a user application might ever take would add overhead to nearly everything, everywhere, for a problem that in practice happens rarely and is usually a bug in the application rather than a systemic risk.

It does NOT make sense in systems where a deadlock is unacceptable regardless of how rare it is: flight control software, medical devices, industrial control systems. Those domains generally use prevention or avoidance instead, accepting the design cost because a hang isn't an option.

What interviewers actually ask about the ostrich algorithm

  • "What is the ostrich algorithm?" Deliberately doing nothing about deadlocks: no prevention, avoidance, or detection, on the bet that the cost of a rare hang is lower than the cost of constant guarding.
  • "Why do general-purpose OSes like Linux use this approach?" Because the overhead of universally guarding every possible resource/lock combination would be large and constant, for a problem that in practice is rare and usually a fixable application bug rather than a systemic risk.
  • "When would the ostrich algorithm be a bad choice?" In safety-critical or high-availability systems where any hang is unacceptable, like real-time control systems or medical devices.
  • "Is this the same as not caring about deadlocks at all?" No, it's a deliberate cost/benefit tradeoff, not neglect; the decision is made consciously, weighing the rarity and recoverability of a deadlock against the constant overhead of preventing or detecting one.

Key takeaways

  • The ostrich algorithm means deliberately not handling deadlocks at all, betting the rare cost of a hang is cheaper than constant prevention/detection overhead.
  • General-purpose OSes like Linux and Windows use this approach for most application-level deadlocks.
  • Safety-critical systems generally can't afford this tradeoff and use real prevention or avoidance instead.
  • It's a considered engineering decision, not an oversight.
All 205 OS interview questions

Browse all Operating Systems topics

Log in to save which topics you've read across every subject.

Frequently asked questions

What is the ostrich algorithm?

Deliberately doing nothing about deadlocks: no prevention, avoidance, or detection, on the bet that the cost of a rare hang is lower than the cost of constant guarding.

Why do general-purpose OSes like Linux use this approach?

Because the overhead of universally guarding every possible resource/lock combination would be large and constant, for a problem that in practice is rare and usually a fixable application bug rather than a systemic risk.

When would the ostrich algorithm be a bad choice?

In safety-critical or high-availability systems where any hang is unacceptable, like real-time control systems or medical devices.

Is this the same as not caring about deadlocks at all?

No, it's a deliberate cost/benefit tradeoff, not neglect; the decision is made consciously, weighing the rarity and recoverability of a deadlock against the constant overhead of preventing or detecting one.