Phase 4
Phase 4 Checkpoint: 15 questions on deadlock.
15 questions · 22 marks · 40 minutes. Negative marking on MCQ only: −1/3 mark for a wrong 1-mark MCQ, −2/3 for a wrong 2-mark MCQ. No negative marking for MSQ or NAT; MSQ has no partial credit.
Q1 · MSQ · 2 mark(s) — Conditions
Which of these, if prevented, make deadlock impossible?
- (A) Context switching
- (B) Circular wait
- (C) Hold and wait
- (D) Mutual exclusion
Q2 · MCQ · 1 mark(s) — RAG
An edge from process P to resource R in a resource-allocation graph means:
- (A) R is free
- (B) P has finished with R
- (C) P is waiting for R
- (D) P holds R
Q3 · MCQ · 2 mark(s) — Multiple instances
A RAG contains a cycle and one of the resources in it has 2 instances. Then:
- (A) deadlock is impossible
- (B) the RAG is wrong
- (C) deadlock is certain
- (D) deadlock is possible but not certain
Q4 · MCQ · 1 mark(s) — Starvation
A low-priority process never gets the CPU because higher-priority processes keep arriving. This is:
- (A) a race condition
- (B) circular wait
- (C) starvation
- (D) deadlock
Q5 · NAT · 1 mark(s) — Need
Max (7, 5, 3), Allocation (0, 1, 0). Need of resource B?
Numerical answer: ________
Q6 · NAT · 2 mark(s) — Banker's
13 units of one resource. A holds 6 (max 9), B holds 2 (max 5), C holds 2 (max 8). How many units are free after the first process of the safe sequence A, B, C finishes?
Numerical answer: ________
Q7 · MCQ · 2 mark(s) — Banker's
In the same state, B asks for 1 more unit. What happens?
- (A) Granted: still safe
- (B) B waits: unsafe
- (C) B waits: not enough free units
- (D) Error: exceeds B's maximum
Q8 · MCQ · 1 mark(s) — Unsafe
Which is true?
- (A) Safe and unsafe mean the same
- (B) Every deadlocked state is unsafe
- (C) Safe states can be deadlocked
- (D) Every unsafe state is a deadlock
Q9 · MCQ · 1 mark(s) — Prevention
Numbering resource types and requesting them only in increasing order breaks:
- (A) circular wait
- (B) no pre-emption
- (C) mutual exclusion
- (D) hold and wait
Q10 · NAT · 2 mark(s) — Safety
Worked example of Lesson 4.1.2 (Available (2,1,2)): after P3 and P1 finish, what is the total of the three Work values?
Numerical answer: ________
Q11 · NAT · 1 mark(s) — Minimum resources
Processes need at most 2, 3, 4 and 5 units of one resource. Minimum units for which deadlock is impossible?
Numerical answer: ________
Q12 · NAT · 2 mark(s) — Maximum processes
A system has 16 units; each process needs at most 4. Largest number of processes that is guaranteed deadlock-free?
Numerical answer: ________
Q13 · NAT · 2 mark(s) — Detection
Lesson 4.1.3's detection example (no changes): in what position does P4 finish in the order the algorithm finds (scanning from P0 each pass)?
Numerical answer: ________
Q14 · MCQ · 1 mark(s) — Recovery
When recovering by pre-emption, what must the OS avoid?
- (A) Choosing a victim
- (B) Re-running detection
- (C) Always picking the same process as the victim
- (D) Rolling back the victim
Q15 · MCQ · 1 mark(s) — Strategy
Most general-purpose operating systems handle deadlock by:
- (A) wait-for graphs on every request
- (B) ignoring it (ostrich approach)
- (C) the banker's algorithm
- (D) requesting all resources at start
✓Answer Vault
Try the questions first. Open when you are ready to check.
🔐 Open the Answer Vault
Q1 Answer: (B) (C) (D) · 2 mark(s)
Breaking any of the four conditions works.
- (A) is wrong: Not a deadlock condition.
Re-read: Lesson 4.1.1 — Deadlock: the four conditions and resource-allocation graphs
Q2 Answer: (C) · 1 mark(s)
Request edge.
- (A) is wrong: Free instances have no edge.
- (B) is wrong: No edge then.
- (D) is wrong: That is R → P.
Re-read: Lesson 4.1.1 — Deadlock: the four conditions and resource-allocation graphs
Q3 Answer: (D) · 2 mark(s)
Another holder may finish and release.
- (A) is wrong: It may still be deadlocked.
- (B) is wrong: Such graphs are valid.
- (C) is wrong: Only with single instances.
Re-read: Lesson 4.1.1 — Deadlock: the four conditions and resource-allocation graphs
Q4 Answer: (C) · 1 mark(s)
It waits indefinitely while others run.
- (A) is wrong: Not about shared data.
- (B) is wrong: No cycle.
- (D) is wrong: Others are not waiting for it.
Re-read: Lesson 4.1.1 — Deadlock: the four conditions and resource-allocation graphs
Q5 Answer: 4 · 1 mark(s)
5 − 1.
Re-read: Lesson 4.1.2 — Prevention and avoidance: safe states and the banker's algorithm
Q6 Answer: 9 · 2 mark(s)
Free 3; A takes 3 more, then returns all 9.
Re-read: Lesson 4.1.2 — Prevention and avoidance: safe states and the banker's algorithm
Q7 Answer: (A) · 2 mark(s)
Free 2; B's need 2 fits; B, then A, then C finish.
- (B) is wrong: A safe sequence exists.
- (C) is wrong: 1 ≤ 3.
- (D) is wrong: 3 ≤ 5.
Re-read: Lesson 4.1.2 — Prevention and avoidance: safe states and the banker's algorithm
Q8 Answer: (B) · 1 mark(s)
A deadlock leaves no way for those processes to finish.
- (A) is wrong: No.
- (C) is wrong: Safe means a finishing order exists.
- (D) is wrong: Unsafe only risks deadlock.
Re-read: Lesson 4.1.2 — Prevention and avoidance: safe states and the banker's algorithm
Q9 Answer: (A) · 1 mark(s)
No cycle can form.
- (B) is wrong: Nothing is taken away.
- (C) is wrong: Still exclusive.
- (D) is wrong: Processes still hold and wait.
Re-read: Lesson 4.1.2 — Prevention and avoidance: safe states and the banker's algorithm
Q10 Answer: 10 · 2 mark(s)
Work (4, 2, 4).
Re-read: Lesson 4.1.2 — Prevention and avoidance: safe states and the banker's algorithm
Q11 Answer: 11 · 1 mark(s)
1 + 2 + 3 + 4 + 1.
Re-read: Lesson 4.1.3 — Detection, recovery, and the minimum-resources formula
Q12 Answer: 5 · 2 mark(s)
3n + 1 ≤ 16.
Re-read: Lesson 4.1.3 — Detection, recovery, and the minimum-resources formula
Q13 Answer: 5 · 2 mark(s)
P3, then P0, P1, P2, P4.
Re-read: Lesson 4.1.3 — Detection, recovery, and the minimum-resources formula
Q14 Answer: (C) · 1 mark(s)
That process would starve.
- (A) is wrong: A victim is needed.
- (B) is wrong: Running detection again is fine.
- (D) is wrong: Rollback is part of the method.
Re-read: Lesson 4.1.3 — Detection, recovery, and the minimum-resources formula
Q15 Answer: (B) · 1 mark(s)
Deadlocks are rare and checks are costly.
- (A) is wrong: Too costly.
- (C) is wrong: Too costly and needs maxima.
- (D) is wrong: Wastes resources.
Re-read: Lesson 4.1.3 — Detection, recovery, and the minimum-resources formula