Practice
Solution
Step 1: Understand the purpose of Banker's Algorithm
The Banker's Algorithm is designed to avoid deadlocks by ensuring that resource allocation requests do not lead the system into an unsafe state.Step 2: Analyze each option
A describes deadlock detection, which is reactive, not proactive like Banker's Algorithm.
B describes scheduling without resource safety checks, which is unrelated.
C correctly identifies deadlock avoidance by simulating allocations to maintain safe states.
D ignores resource safety and deadlock avoidance, focusing on naive allocation.Final Answer:
Option C -> Option CQuick Check:
Banker's Algorithm is a deadlock avoidance method, not detection or naive scheduling.
- Confusing deadlock detection with avoidance
- Assuming Banker's Algorithm schedules processes
- Believing it works without resource safety checks
Solution
Step 1: Identify overhead of context switch
Saving/restoring CPU registers and PCB updates consume CPU time, causing overhead.Step 2: Scheduler availability
The scheduler can always select processes; running out is not a cause of performance degradation.Step 3: MMU and page tables
MMU page table reloads happen on address space switches, but not necessarily on every context switch.Step 4: CPU cache behavior
CPU cache is not flushed automatically on every context switch; cache invalidation is more complex.Final Answer:
Option A -> Option AQuick Check:
Context switch overhead is mainly CPU cycles spent saving/restoring registers.
- Believing scheduler runs out of processes
- Assuming MMU reloads page tables every switch
- Thinking CPU cache flushes on every context switch
Solution
Step 1: Analyze buddy system behavior
Buddy system allocates blocks in powers of two, causing internal fragmentation when requested size is not a power of two.Step 2: Evaluate other options
It does not eliminate external fragmentation completely (B); compaction is a separate technique (C); it is efficient for fixed-size allocations (D is incorrect).Final Answer:
Option A -> Option AQuick Check:
Internal fragmentation is a known trade-off in buddy system [OK]
- Believing buddy system removes all external fragmentation
- Confusing compaction as part of buddy system
- Assuming buddy system is inefficient for variable sizes
Solution
Step 1: Understand starvation in preemptive SJF
Shorter jobs can continuously preempt longer ones, causing longer processes to wait indefinitely.Step 2: Analyze other options
A: While context switches increase, CPU utilization remains high; overhead is a concern but not utilization.
B: Preemptive SJF generally reduces average turnaround time, not increases it.
D: Preemptive SJF is designed to handle processes arriving at different times.Final Answer:
Option B -> Option BQuick Check:
Starvation is a classic drawback of preemptive SJF.
- Confusing turnaround time impact
- Assuming preemptive SJF cannot handle dynamic arrivals
Solution
Step 1: Understand cyclic reference pattern larger than frames
Pages are referenced in a cycle longer than available frames, causing repeated evictions.Step 2: Analyze LRU vs FIFO behavior
Both algorithms will evict pages that will be needed soon because the working set exceeds frame count.
LRU's advantage diminishes as no page stays long enough to be reused before eviction.Step 3: Evaluate options
LRU will have fewer page faults because it always evicts the least recently used page is false; LRU advantage is lost in cyclic patterns larger than frames.
LRU will perform optimally and minimize page faults in cyclic patterns is false; both have similar fault rates in this scenario.
LRU will have more page faults than FIFO because it keeps evicting pages that will be needed soon is false; LRU does not necessarily have more faults than FIFO here.
LRU and FIFO will have similar page fault rates due to cyclic references exceeding frame count is true; LRU and FIFO have similar fault rates due to cyclic references exceeding frame count.Final Answer:
Option D -> Option DQuick Check:
When working set > frames, LRU and FIFO fault rates converge.
- Assuming LRU always outperforms FIFO
- Believing cyclic patterns favor LRU
- Thinking LRU is optimal in all cases
