Practice
Solution
Step 1: User program issues system call
The user program executes a special instruction causing a trap to kernel mode.Step 2: CPU switches to kernel mode
Control transfers to the OS kernel with elevated privileges.Step 3: Kernel validates system call
The kernel inspects the system call number and arguments to ensure they are valid and safe.Step 4: Why other options are incorrect
The kernel copies data directly to the user buffer without validation is unsafe; kernel must validate before copying data. The user program resumes execution in user mode happens after system call completion, not immediately after mode switch. The hardware raises an interrupt to the device is unrelated here; hardware interrupts occur asynchronously, not immediately after mode switch.Final Answer:
Option A -> Option AQuick Check:
System call trap -> kernel mode -> validate call -> execute service [OK]
- Assuming kernel copies data before validation
- Confusing interrupt handling with system call flow
- Thinking user mode resumes immediately after trap
Solution
Step 1: Understand the global waiter approach
A global waiter serializes fork acquisition requests to prevent circular wait.Step 2: Analyze trade-offs
This centralization simplifies deadlock prevention but creates a single point of failure and can bottleneck performance.Step 3: Evaluate other options
It increases concurrency but risks livelock under high contention is incorrect as concurrency is reduced; It eliminates deadlock but can cause starvation due to unfair scheduling is incorrect because starvation is not guaranteed; It guarantees fairness but requires complex priority inheritance mechanisms is incorrect as priority inheritance is unrelated here.Final Answer:
Option A -> Option AQuick Check:
Centralized control trades deadlock prevention for potential bottleneck and failure risk.
- Confusing starvation with deadlock prevention
- Assuming increased concurrency with global waiter
- Misattributing priority inheritance to this solution
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: Understand aging purpose
Aging gradually increases the priority of waiting processes to ensure they eventually get CPU time, preventing starvation.Step 2: Identify downside
Over-aggressive aging can cause priority inversion, where lower-priority processes gain higher priority than intended, disrupting scheduling fairness.Step 3: Analyze options
Aging increases priority of waiting processes to prevent starvation but can cause priority inversion if overused correctly states aging's purpose and downside. Aging decreases priority of high-priority processes to prevent deadlock but may cause livelock incorrectly associates aging with deadlock prevention and livelock. Aging randomly changes priorities to balance load but can lead to starvation of critical processes misrepresents aging as random priority changes. Aging forces processes to release resources periodically but increases overhead significantly confuses aging with resource release policies.Final Answer:
Option A -> Option AQuick Check:
Aging = priority boost to prevent starvation, risk of priority inversion.
- Confusing aging with deadlock prevention
- Thinking aging randomly changes priorities
Solution
Step 1: Review privilege separation
User mode is restricted; kernel mode has full privileges.Step 2: Validate each statement
User mode code cannot directly access kernel memory for protection reasons. is true; user mode cannot access kernel memory. Kernel mode has unrestricted access to all hardware and memory. is true; kernel mode has full access. Mode switches are triggered by traps or interrupts to ensure controlled privilege escalation. is true; traps/interrupts cause mode switches.Step 3: Identify incorrect statement
System calls execute entirely in user mode without switching to kernel mode. is false; system calls require switching to kernel mode to execute privileged operations.Final Answer:
Option D -> Option DQuick Check:
System calls always involve mode switch to kernel [OK]
- Believing system calls run entirely in user mode
- Confusing hardware interrupts with system calls
- Assuming user mode can access kernel memory
