Phase 2
Phase 2 Checkpoint: 15 questions on CPU scheduling.
15 questions · 23 marks · 45 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 · NAT · 1 mark(s) — Formulas
A process arrives at 3, needs 5 ms of CPU and completes at 20. Waiting time?
Numerical answer: ________
Q2 · NAT · 2 mark(s) — FCFS
Running example (P1 0/8, P2 1/4, P3 2/9, P4 3/5, P5 4/2) under FCFS: completion time of P4?
Numerical answer: ________
Q3 · MCQ · 1 mark(s) — Metric
For an interactive system, the most important metric is usually:
- (A) throughput
- (B) response time
- (C) turnaround time of batch jobs
- (D) disk utilisation
Q4 · NAT · 2 mark(s) — SJF
All arrive at 0 with bursts 6, 8, 7, 3 (SJF). Average waiting time?
Numerical answer: ________
Q5 · NAT · 2 mark(s) — SRTF
Running example under SRTF: waiting time of P1?
Numerical answer: ________
Q6 · NAT · 2 mark(s) — SRTF
SRTF: P1 (AT 0, BT 9), P2 (AT 1, BT 4), P3 (AT 2, BT 9). Average turnaround time (2 decimals)?
Numerical answer: ________
Q7 · NAT · 1 mark(s) — Prediction
α = 0.5, τ₀ = 10, actual bursts 6 then 4. Prediction τ₂?
Numerical answer: ________
Q8 · NAT · 2 mark(s) — Priority
Running example under pre-emptive priority: average waiting time?
Numerical answer: ________
Q9 · NAT · 1 mark(s) — HRRN
A job waited 9 ms and needs 3 ms. Response ratio?
Numerical answer: ________
Q10 · MCQ · 1 mark(s) — Starvation
Which algorithm can NOT cause starvation?
- (A) Round robin
- (B) SRTF
- (C) Priority without aging
- (D) SJF
Q11 · NAT · 2 mark(s) — RR
Running example, RR with q = 4: average response time?
Numerical answer: ________
Q12 · NAT · 2 mark(s) — RR
Running example, RR with q = 3: completion time of P2?
Numerical answer: ________
Q13 · MCQ · 1 mark(s) — Quantum
Making the time quantum very small mainly increases:
- (A) starvation
- (B) the convoy effect
- (C) throughput
- (D) context-switch overhead
Q14 · NAT · 2 mark(s) — CPU + I/O
Two processes arrive at 0 (FCFS on the CPU, separate I/O devices). A: CPU 4, I/O 6, CPU 2. B: CPU 3, I/O 2, CPU 3. Total CPU idle time until both finish?
Numerical answer: ________
Q15 · NAT · 1 mark(s) — Utilisation
2 processes each wait for I/O 90% of the time. CPU utilisation?
Numerical answer: ________
✓Answer Vault
Try the questions first. Open when you are ready to check.
🔐 Open the Answer Vault
Q1 Answer: 12 · 1 mark(s)
TAT 17 − BT 5.
Re-read: Lesson 2.1.1 — Scheduling basics: the times we measure; first-come first-served
Q2 Answer: 26 · 2 mark(s)
P1 0–8, P2 8–12, P3 12–21, P4 21–26.
Re-read: Lesson 2.1.1 — Scheduling basics: the times we measure; first-come first-served
Q3 Answer: (B) · 1 mark(s)
Users notice how soon something happens.
- (A) is wrong: Batch-oriented.
- (C) is wrong: Batch-oriented.
- (D) is wrong: Not a CPU-scheduling metric.
Re-read: Lesson 2.1.1 — Scheduling basics: the times we measure; first-come first-served
Q4 Answer: 7 · 2 mark(s)
Order 3, 6, 7, 8: waits 0, 3, 9, 16.
Re-read: Lesson 2.1.2 — Shortest job first and shortest remaining time first
Q5 Answer: 11 · 2 mark(s)
TAT 19 − BT 8.
Re-read: Lesson 2.1.2 — Shortest job first and shortest remaining time first
Q6 Answer: 12.33 to 12.34 · 2 mark(s)
P1 0–1, P2 1–5, P1 5–13, P3 13–22: TAT 13, 4, 20 → 37/3.
Re-read: Lesson 2.1.2 — Shortest job first and shortest remaining time first
Q7 Answer: 6 · 1 mark(s)
τ₁ = 8; τ₂ = 0.5 × 4 + 0.5 × 8.
Re-read: Lesson 2.1.2 — Shortest job first and shortest remaining time first
Q8 Answer: 9.6 · 2 mark(s)
48/5.
Re-read: Lesson 2.1.3 — Priority scheduling, starvation and aging; highest response ratio next
Q9 Answer: 4 · 1 mark(s)
12/3.
Re-read: Lesson 2.1.3 — Priority scheduling, starvation and aging; highest response ratio next
Q10 Answer: (A) · 1 mark(s)
Every process gets a turn.
- (B) is wrong: Long jobs can starve.
- (C) is wrong: Low priorities can starve.
- (D) is wrong: Long jobs can starve.
Re-read: Lesson 2.1.3 — Priority scheduling, starvation and aging; highest response ratio next
Q11 Answer: 6 · 2 mark(s)
First starts 0, 4, 8, 12, 16 minus arrivals 0–4.
Re-read: Lesson 2.2.1 — Round robin and the time quantum
Q12 Answer: 18 · 2 mark(s)
P2 runs 3–6 and 17–18.
Re-read: Lesson 2.2.1 — Round robin and the time quantum
Q13 Answer: (D) · 1 mark(s)
Many more switches.
- (A) is wrong: RR does not starve.
- (B) is wrong: That is FCFS's problem.
- (C) is wrong: Overhead lowers throughput.
Re-read: Lesson 2.2.1 — Round robin and the time quantum
Q14 Answer: 2 · 2 mark(s)
A 0–4, B 4–7; both now doing I/O, so the CPU is idle 7–9; B (back at 9) runs 9–12; A (back at 10) waits and runs 12–14.
Re-read: Lesson 2.2.2 — Multilevel queues, CPU and I/O bursts, CPU utilisation
Q15 Answer: 0.19 · 1 mark(s)
1 − 0.81.
Re-read: Lesson 2.2.2 — Multilevel queues, CPU and I/O bursts, CPU utilisation