Practice
Solution
Step 1: Identify circular wait
Each process holds a resource and waits for another held by the next process, forming a cycle.Step 2: Understand consequences
Because each process waits for a resource held by another in the cycle, none can proceed, causing indefinite waiting.Step 3: Analyze other options
One process releases its resource voluntarily, breaking the cycle immediately assumes voluntary release, which is not guaranteed. The operating system preempts resources from one process to resolve the wait involves preemption, which is not part of the circular wait condition. Processes detect the cycle and terminate themselves automatically assumes automatic termination, which is not standard behavior.Final Answer:
Option A -> Option AQuick Check:
Circular wait leads to indefinite blocking without external intervention.
- Assuming processes will release resources voluntarily
- Confusing circular wait with preemption or automatic recovery
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 resource sharing scenario
Multiple identical resources mean more than one thread can access simultaneously but limited by resource count.Step 2: Evaluate synchronization primitives
Mutex and binary semaphore allow only one thread at a time, unsuitable for multiple identical resources.Step 3: Counting semaphore suitability
Counting semaphore maintains a count of available resources, allowing multiple threads up to the count.Step 4: Spinlock consideration
Spinlocks are low-level and busy-wait, not ideal for managing multiple identical resources efficiently.Final Answer:
Option D -> Option DQuick Check:
Counting semaphore matches the scenario of multiple identical resources.
- Confusing mutex with counting semaphore for multiple resources
- Assuming binary semaphore can handle multiple identical resources
- Believing spinlocks are suitable for resource counting
Solution
Step 1: At time 0
Only P1 has arrived, so P1 starts running.Step 2: At time 1
P2 arrives with burst 4, which is less than P1's remaining 7, so preemption occurs and P2 runs.Step 3: At time 2
P3 arrives with burst 2, less than P2's remaining 3, so preemption occurs and P3 runs.Step 4: At time 3
P3 has run 1 unit (remaining 1), P2 and P1 are waiting. Since P3 has the shortest remaining time, it continues running.Final Answer:
Option C -> Option CQuick Check:
At time 3, the shortest remaining burst is P3's 1 unit, so P3 runs.
- Not preempting when a shorter job arrives
- Assuming the first process continues until completion
Solution
Step 1: Understand current mode
Interrupt handlers run in kernel mode with full privileges.Step 2: System call invoked in kernel mode
Since already in kernel mode, no mode switch is needed; system call executes directly.Step 3: Why other options are incorrect
The CPU switches to user mode before executing the system call to prevent privilege escalation. is incorrect; switching to user mode would reduce privileges improperly. The system call is deferred until the interrupt handler finishes and user mode resumes. is wrong; system calls are not deferred. The system call triggers a nested mode switch to a higher privilege level. is false; kernel mode is the highest privilege level, no nested switch occurs.Final Answer:
Option C -> Option CQuick Check:
System call in kernel mode -> no mode switch -> immediate execution [OK]
- Assuming mode switch always occurs on system call
- Thinking system calls are deferred inside kernel
- Believing nested privilege levels exist beyond kernel mode
