Practice
Solution
Step 1: Understand the role of PCB
The PCB stores the CPU register states and other process information needed to resume execution later.Step 2: Differentiate from scheduler and interrupt handler
The scheduler decides which process runs next but does not save registers; the interrupt handler triggers context switches but does not save registers itself.Step 3: MMU role
The MMU handles memory address translation, unrelated to register saving.Final Answer:
Option D -> Option DQuick Check:
PCB contains saved CPU state -> correct component for saving/restoring registers.
- Confusing scheduler with register saving
- Assuming interrupt handler saves registers
- Thinking MMU handles CPU state
Solution
Step 1: Review C-SCAN behavior
C-SCAN moves the head in one direction, servicing requests, then jumps back to the start without servicing requests on the return.Step 2: Understand fairness and wait times
This approach provides uniform wait times and avoids starvation.Step 3: Analyze each option
C-SCAN eliminates starvation by always servicing the closest request next. is incorrect because C-SCAN does not always service the closest request next; it ignores requests on the return jump.Final Answer:
Option B -> Option BQuick Check:
C-SCAN eliminates starvation by always servicing the closest request next. is the only incorrect statement about C-SCAN.
- Assuming C-SCAN always picks the closest request next
- Confusing C-SCAN with SCAN regarding servicing on return
- Believing C-SCAN causes starvation
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: Initialization of semaphores
'empty' starts at buffer size; 'full' starts at zero -- both correct.Step 2: Role of mutex
Mutex is essential to ensure mutual exclusion when accessing the buffer; semaphores alone do not provide this.Step 3: Blocking behavior
Producers and consumers block on semaphores to avoid busy-waiting, which is correct.Step 4: Why 'Mutex is optional if semaphores are used correctly' is incorrect
Claiming mutex is optional is a common misconception; without mutex, race conditions occur.Final Answer:
Option A -> Option AQuick Check:
Mutex is mandatory for mutual exclusion [OK]
- Believing semaphores alone guarantee mutual exclusion
- Misinitializing semaphore counts
- Thinking blocking is done by mutex
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
