Practice
Solution
Step 1: Recall mutex ownership semantics
Mutex enforces ownership; only the thread that locked it can unlock it.Step 2: Attempt to release by non-owner
When a non-owner thread tries to release, the system detects violation.Step 3: System response
Typically, an error or exception is raised to prevent undefined behavior.Step 4: Why other options fail
The mutex is released successfully, allowing other threads to acquire it ignores ownership rules; C allows silent failure risking deadlock; B incorrectly transfers ownership.Final Answer:
Option B -> Option BQuick Check:
Mutex ownership is strict; releasing by non-owner triggers error.
- Assuming mutex releases silently even if non-owner calls unlock
- Believing ownership transfers automatically on release
- Thinking mutex behaves like a semaphore without ownership
Solution
Step 1: Role of semaphores
Semaphores can block threads and track resource counts but do not inherently provide mutual exclusion.Step 2: Need for mutual exclusion
Without a mutex, multiple producers or consumers can simultaneously modify the buffer, causing race conditions and data corruption.Step 3: Why other options are incorrect
Semaphores cannot block threads, so busy-waiting occurs is false because semaphores do block; Semaphores cause deadlocks if used without mutexes is incorrect as deadlocks depend on usage, not absence of mutex; Semaphores increase memory usage exponentially without mutex is false as semaphores do not cause exponential memory growth.Final Answer:
Option D -> Option DQuick Check:
Semaphores synchronize counts but mutex needed for exclusive buffer access [OK]
- Assuming semaphores alone prevent race conditions
- Confusing blocking behavior of semaphores
- Believing mutexes cause deadlocks by default
Solution
Step 1: Per-CPU context switch cost
Each CPU still saves/restores registers during context switches, so overhead per CPU is similar to single-core.Step 2: Additional multi-core factors
Multi-core systems require cache coherence protocols and synchronization mechanisms, adding overhead beyond single-core context switching.Step 3: Misconceptions
Context switching is not eliminated; CPUs do not save/restore registers twice per switch; scheduler speedup is not guaranteed.Final Answer:
Option A -> Option AQuick Check:
Multi-core adds complexity beyond per-CPU context switch overhead.
- Thinking multi-core removes context switch overhead
- Assuming overhead doubles incorrectly
- Believing scheduler is always faster on multi-core
Solution
Step 1: Identify internal fragmentation cause
Buddy system rounds allocations to power-of-two sizes, causing internal fragmentation.Step 2: Evaluate strategies
Slab allocator efficiently manages fixed-size objects, reducing internal fragmentation without slowing allocation.Step 3: Analyze other options
Increasing minimum block size (A) increases internal fragmentation; compaction (C) addresses external fragmentation; fixed partitioning (D) is inflexible and can worsen fragmentation.Final Answer:
Option C -> Option CQuick Check:
Slab allocators complement buddy system to reduce internal fragmentation [OK]
- Thinking compaction reduces internal fragmentation
- Assuming bigger minimum block size reduces fragmentation
- Believing fixed partitioning eliminates fragmentation
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
