quiz

Deadlock in Operating System

1. How does a deadlock occur in an operating system?

  • A) When a process is terminated abruptly.
  • B) When a process enters a waiting state due to a resource held by another waiting process.
  • C) When a process completes its execution successfully.
  • D) When a process requests a resource that is currently available.
B) When a process enters a waiting state due to a resource held by another waiting process. Explanation

2. Which set of conditions, known as the Coffman conditions, are necessary for a deadlock to occur in a system?

  • A) Mutual exclusion, hold and wait, no preemption, circular wait
  • B) Preemptive scheduling, resource allocation, circular wait
  • C) Resource sharing, multiple threads, mutual exclusion
  • D) Shared memory, context switching, hold and wait
A) Mutual exclusion, hold and wait, no preemption, circular wait Explanation

3. Which aspect of deadlock management is directly addressed by the Banker’s Algorithm?

  • A) Detection
  • B) Avoidance
  • C) Prevention
  • D) Recovery
B) Avoidance Explanation

4. What does the mutual exclusion condition imply in the context of deadlock?

  • A) Multiple threads can modify a shared resource at the same time
  • B) Only one thread can access a critical section at a time
  • C)  Threads must wait in line based on priority before accessing any resource.
  • D) Two threads can write to a shared resource simultaneously
B) Only one thread can access a critical section at a time Explanation

5. What data structures are used in the Banker’s Algorithm?

  • A) Available, Maximum, Allocation, Need
  • B) Wait-for Graph, Ready Queue, Priority Queue
  • C) Page Table, Frame Table, Disk Queue
  • D) Free List, Swap Space, Ready Queue
A) Available, Maximum, Allocation, Need Explanation

6. In a resource allocation graph, a deadlock exists if and only if:

  • A) The graph has no cycles.
  • B) The graph is a tree.
  • C) The graph has at least one cycle.
  • D) The graph is bipartite.
A) The graph has no cycles. Explanation

7. Which of the following is NOT a method for deadlock recovery?

  • A) Resource preemption
  • B) Process termination
  • C) Process rollback
  • D) Priority inversion
D) Priority inversion Explanation

8. What is the condition called when a system cannot allocate resources to processes in such a way that all processes can be completed without leading to a deadlock?

  • A) Safe state
  • B) Unsafe state
  • C) Deadlock state
  • D) Blocking state
B) Unsafe state Explanation

9. Which method uses a predefined sequence to acquire locks, preventing circular wait conditions?

  • A) Wait-For-Graph algorithms
  • B) Lock reference-counting
  • C)  Lock hierarchies
  • D) Heuristic algorithms
C) Lock hierarchies Explanation

10. Why do phantom deadlocks occur in distributed systems?

  • A) Due to inaccurate detection algorithms
  • B) Due to delayed or outdated information in the system
  • C) Because of network failures
  • D) Due to software bugs
B) Due to delayed or outdated information in the system Explanation