Operating System Fundamentals
Prof. Santanu Chattopadhyay
IIT Kharagpur
Assignment 08 (Week 08)
Q1.
Which of the following conditions is not a necessary condition for a deadlock to occur?
(A) Mutual Exclusion
(B) Hold and Wait
(C) Resource preemption
(D) Circular Wait
Answer: (C) Resource preemption
Q2.
What happens when a philosopher successfully picks up their left chopstick but then waits
indefinitely for the right one?
(A) The philosopher enters a livelock.
(B) The philosopher has a race condition.
(C) The philosopher experiences starvation.
(D) The philosopher contributes to a potential deadlock.
Answer: (D) The philosopher contributes to a potential deadlock.
Q3.
A wait-for graph contains a cycle, and the system has NO deadlock. Then which of the
following statements is correct (maximum suitable)?
(A) Each resource type has only one instance.
(B) At least one resource type is there with more than one instance.
(C) Each resource type has more than one instance.
(D) None of the above
Answer: (B) At least one resource type is there with more than one instance.
Q4.
Deadlock avoidance describes a system design where a process is only granted resources if
granting the request would not lead to a deadlock situation. This is achieved by ensuring
which of the following?
(A) At least one of the four deadlock conditions (mutual exclusion, hold and wait, no
preemption, and circular wait) is never met.
(B) All of the four deadlock conditions (mutual exclusion, hold and wait, no preemption, and
circular wait) are never met.
(C) The three conditions mutual exclusion, hold and wait, and no preemption are never met.
(D) None of the above.
Answer: (A) At least one of the four deadlock conditions (mutual exclusion, hold and wait,
no preemption, and circular wait) is never met.
Q5.
A computer system has five (05) processes P0, P1, P2, P3, P4 and three (03) types of
resources A, B, and C. The current allocation matrix, the maximum need matrix and the
available matrix are shown below for all processes resource-wise:
Process Current Maximum Need Available
Allocation
A B C A B C A B C
P0 0 1 0 7 5 3 3 3 2
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 2 2 2
P4 0 0 2 4 3 3
Choose the correct answer.
(A) The system is unsafe and may lead to a deadlock.
(B) The system is unsafe but can automatically recover from a deadlock.
(C) The system is safe. One safe sequence is P1 → P3 → P0 → P2 → P4.
(D) The system is safe. One safe sequence is P4 → P0 → P1 → P2 → P3.
Answer: (C) The system is safe. One safe sequence is P1 → P3 → P0 → P2 → P4.
Q6.
A computer system has four (04) processes P0, P1, P2, P3 and three types of resources A, B,
and C. The total number of available resources for each type is A = 10, B = 5, and C = 7.
The current allocation matrix, and the maximum need matrix are shown below for all
processes resource-wise:
Process Current Allocation Maximum Need
A B C A B C
P0 0 1 0 7 5 3
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 4 2 2
Choose the correct answer.
(A) The system is unsafe and may lead to a deadlock.
(B) The system is unsafe but can automatically recover from a deadlock.
(C) The system is safe. One safe sequence is P3 → P1 → P0 → P2.
(D) The system is safe. One safe sequence is P1 → P0 → P2 → P3.
Answer: (C) The system is safe. One safe sequence is P3 → P1 → P0 → P2.
Q7.
Assume that V is the number of processes (vertices) and E is the number of wait-for
relationships (edge from the waiting process to the holding process) in the wait-for graph.
The time complexity to detect a cycle in the wait-for graph using DFS traversal is:
(A) O(V 3)
(B) O(V)
(C) O(V + E)
(D) O(V 2)
Answer: (C) O(V + E)
Q8.
A Wait-For graph can detect deadlock for systems with
(A) Single-instance resources only
(B) Multi-instance resources only
(C) Both single- and multi-instance resources
(D) None of the other options
Ans: (A) Single-instance resources only
Q9. The resource(s) that cannot be preempted from a process to solve deadlock
(A) CPU time
(B) Memory
(C) Printer
(D) All the other options
Ans: (C) Printer
Q10. In the context of deadlock, from an unsafe state, system can transit to
(A) Unsafe state
(B) Safe state
(C) Deadlocked
(D) All of the other options
Ans: (D) All of the other options