Practice
Solution
Step 1: Understand deadlock conditions
Deadlock occurs when each process holds a resource and waits for the other, causing indefinite blocking.Step 2: Analyze the immediate aftermath
Neither process releases resources voluntarily, so both remain blocked indefinitely (both processes remain blocked indefinitely, waiting for the other to release the resource). Both processes releasing their held resources and retrying immediately is incorrect because processes do not release resources spontaneously. The operating system preempting one process to break the deadlock automatically is incorrect as OS preemption is not automatic in typical deadlock. Both processes entering a livelock, continuously retrying without progress describes livelock, which involves active state changes, not blocking.Final Answer:
Option A -> Option AQuick Check:
Deadlock means indefinite waiting without resource release, matching both processes remain blocked indefinitely, waiting for the other to release the resource.
- Assuming OS automatically resolves deadlock
- Confusing deadlock with livelock
Solution
Step 1: Understand the Need matrix definition
Need = Maximum demand - Allocation, not Allocation - Maximum demand.Step 2: Verify other statements
A is correct; starting in a safe state is necessary.
C is correct; unsafe requests are denied.
D is correct; simulation is core to the algorithm.Final Answer:
Option B -> Option BQuick Check:
Remember Need = Max - Allocation, not the reverse.
- Mixing up Need matrix calculation
- Assuming algorithm works from unsafe states
- Believing unsafe requests are sometimes granted
Solution
Step 1: Identify Peterson's algorithm characteristics
Peterson's algorithm uses busy waiting (spinlock), which can waste CPU resources.Step 2: Analyze other options
It cannot guarantee mutual exclusion under any circumstances is false because mutual exclusion is guaranteed. It depends on hardware atomic instructions to function correctly is incorrect since Peterson's algorithm was designed to avoid hardware atomic instructions. It allows unbounded waiting, leading to starvation is wrong because bounded waiting is guaranteed.Final Answer:
Option B -> Option BQuick Check:
Busy waiting is a known practical limitation of Peterson's algorithm.
- Assuming Peterson's needs hardware atomic instructions
- Confusing bounded waiting with starvation
- Believing mutual exclusion can fail
Solution
Step 1: Verify correctness of each statement
Options A, C, and D are true properties of Peterson's algorithm.Step 2: Identify incorrect statement
It can be extended straightforwardly to more than two processes is incorrect because Peterson's algorithm is specifically designed for two processes and does not extend easily to multiple processes.Final Answer:
Option A -> Option AQuick Check:
Peterson's algorithm is a two-process solution only.
- Assuming easy extension to multiple processes
- Confusing bounded waiting with starvation
- Believing hardware instructions are required
Solution
Step 1: Understand process types in FCFS
FCFS schedules strictly by arrival order, regardless of process type.Step 2: Analyze impact of mixed workloads
CPU-bound processes arriving first can delay I/O-bound processes, worsening the convoy effect and increasing waiting times.Step 3: Mitigation strategy
Introducing preemption or priority scheduling can reduce waiting times for I/O-bound processes by allowing them to run sooner.Step 4: Evaluate options
A is incorrect; convoy effect does not disappear automatically.
B is correct; convoy effect worsens and preemption helps.
C is incorrect; waiting times do change due to process mix.
D is incorrect; convoy effect is relevant because all processes compete for CPU.Final Answer:
Option B -> Option BQuick Check:
Mixed workloads worsen convoy effect; preemption mitigates it.
- Assuming I/O-bound processes run first automatically
- Believing waiting times don't change with process mix
- Ignoring convoy effect in mixed workloads
