CS FundamentalsModerateTCS NQT · Infosys pattern

Which statement correctly contrasts deadlock avoidance (Banker's algorithm) with deadlock detection-and-recovery?

  1. A. Avoidance requires processes to declare maximum resource needs in advance and checks every request against a safety test; detection lets the system run freely and periodically checks for existing deadlocks, then recovers (e.g. by rollback or killing a process)
  2. B. Avoidance and detection are two names for the same technique
  3. C. Detection always runs faster than avoidance because it needs no extra bookkeeping
  4. D. Avoidance can only be used with a single resource instance of each type

Correct answer: A. Avoidance requires processes to declare maximum resource needs in advance and checks every request against a safety test; detection lets the system run freely and periodically checks for existing deadlocks, then recovers (e.g. by rollback or killing a process)

Avoidance is proactive and conservative: it never lets the system enter an unsafe state, at the cost of needing advance knowledge of maximum demands and per-request overhead. Detection is reactive: it allows requests freely (so unsafe states can occur), periodically runs a detection algorithm, and recovers only if an actual deadlock is found — generally cheaper when deadlocks are rare.

More Operating Systems questions

Exams that ask this topic