Practice
Solution
Step 1: Initialize FIFO with empty frames
Frames: []Step 2: Process each page in order
1 -> fault, frames: [1]
2 -> fault, frames: [1,2]
3 -> fault, frames: [1,2,3]
4 -> fault, evict 1, frames: [4,2,3]
1 -> fault, evict 2, frames: [4,1,3]
2 -> fault, evict 3, frames: [4,1,2]
5 -> fault, evict 4, frames: [5,1,2]
1 -> hit
2 -> hit
3 -> fault, evict 1, frames: [5,3,2]
4 -> fault, evict 2, frames: [5,3,4]
5 -> hitStep 3: Count faults
Total faults = 9Final Answer:
Option B -> Option BQuick Check:
FIFO evicts oldest page regardless of future use, causing 9 faults here.
- Counting hits as faults
- Misordering evictions in FIFO
- Forgetting to update frames after eviction
Solution
Step 1: Understand the role of PCB during state transitions
The PCB stores the process state, CPU registers, and scheduling information during context switches.Step 2: Analyze each option
A: PCB is created at process creation but its primary use is during context switches, not just at New to Ready.
B: PCB is involved in termination but mainly to release resources; it is not primarily used to delete data.
C: Processes in Ready state do not execute instructions directly; they wait for CPU allocation.
D: Correct. When a process moves from Running to Waiting, the PCB saves CPU registers and state for resumption.Final Answer:
Option D -> Option DQuick Check:
PCB is essential for saving CPU state during Running to Waiting transitions [OK]
- Thinking PCB is only used at process creation
- Assuming Ready state processes execute instructions
- Believing PCB is deleted immediately at termination
Solution
Step 1: Identify the event
The process requests I/O while Running, so it must wait for I/O completion.Step 2: State transition on I/O request
Process moves from Running to Waiting state to wait for I/O.Step 3: After I/O completes
Process moves from Waiting to Ready state, waiting for CPU scheduling.Step 4: CPU scheduling
Process moves from Ready to Running when CPU is allocated.Final Answer:
Option A -> Option AQuick Check:
Running -> Waiting (I/O request), Waiting -> Ready (I/O done), Ready -> Running (CPU assigned) [OK]
- Confusing Ready and Waiting states order
- Assuming process goes directly from Waiting to Running
- Skipping the Ready state after I/O completion
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 Ready state resource usage
Processes in Ready state do not consume CPU cycles but occupy scheduling queues.Step 2: Analyze each option
A: Correct. Long Ready times cause loss of CPU cache locality and increase context switch overhead when finally scheduled.
B: Incorrect. Processes do not hold exclusive I/O or memory resources just by being Ready.
C: Incorrect. Ready processes do not consume CPU cycles.
D: Incorrect. Ready processes do not cause deadlocks by not performing I/O.Final Answer:
Option A -> Option AQuick Check:
Ready state delays hurt cache locality and increase context switch costs [OK]
- Believing Ready processes consume CPU cycles
- Assuming Ready processes hold exclusive resources
- Confusing Ready state with Waiting state regarding I/O
