CS FundamentalsModerateTCS NQT · Infosys pattern
Which statement correctly contrasts deadlock avoidance (Banker's algorithm) with deadlock detection-and-recovery?
- 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)
- B. Avoidance and detection are two names for the same technique
- C. Detection always runs faster than avoidance because it needs no extra bookkeeping
- 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
- A system with 3 CPU cores uses symmetric multiprocessing (SMP), where every core runs the same copy of the OS kernel and can access any…
- A real-time system has two periodic tasks: Task A with period 20 ms and execution time 5 ms, Task B with period 50 ms and execution time…
- Compare Rate Monotonic Scheduling (RMS, static priority by period) and Earliest Deadline First (EDF, dynamic priority by nearest deadline)…
- A system call interface lets a user program request a kernel service (like opening a file). What is the typical hardware-assisted…
- Copy-on-write (COW) is used after fork() to avoid copying the entire parent's address space immediately. How does it work?
- A process has a single-level page table with a 'valid/invalid' bit per entry. A memory reference to a page marked invalid causes a page…