Practice
Solution
Step 1: Understand 'Hold and Wait'
This condition requires a process to hold at least one resource while waiting to acquire additional resources. A process holds one resource and waits to acquire another resource already held by another process directly describes this scenario.Step 2: Analyze other options
A process requests all required resources at once before execution begins avoids hold and wait by requesting all resources upfront. A process releases all resources before requesting new ones releases resources before requesting new ones, preventing hold and wait. A process can forcibly preempt resources from other processes describes preemption, which is a different condition.Final Answer:
Option D -> Option DQuick Check:
Only a process holding one resource and waiting to acquire another resource already held by another process matches the hold and wait condition necessary for deadlock.
- Confusing hold and wait with requesting all resources at once
- Thinking preemption is part of hold and wait
Solution
Step 1: Understand contiguous allocation characteristics
Contiguous allocation stores all file blocks sequentially on disk, enabling fast sequential and direct access without extra pointers.Step 2: Analyze when fast sequential and direct access to file blocks is required with minimal overhead
Fast sequential and direct access is exactly what contiguous allocation optimizes for.Step 3: Analyze when files are frequently extended or shrunk dynamically during runtime
Contiguous allocation struggles with dynamic file size changes due to fragmentation and need for contiguous free space.Step 4: Analyze when the file system must handle very large files with unpredictable sizes
Large unpredictable files are better handled by linked or indexed allocation to avoid fragmentation and allocation overhead.Step 5: Analyze when minimizing external fragmentation is the highest priority
Contiguous allocation tends to cause external fragmentation, so it does not minimize it.Final Answer:
Option C -> Option CQuick Check:
Contiguous allocation -> fast access but poor flexibility and fragmentation handling.
- Assuming contiguous allocation handles dynamic file sizes well
- Confusing fragmentation minimization with contiguous allocation benefits
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: 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 mode switch cost
Switching from user to kernel mode involves saving/restoring CPU state and flushing pipelines, which is expensive.Step 2: Why not all services as system calls
Excessive mode switches degrade performance, so only critical OS services use system calls.Step 3: Why other options are incorrect
Because system calls cannot access hardware devices is false; system calls are the mechanism to access hardware safely. Because user mode has unrestricted access to kernel data structures is false; user mode is restricted from kernel data. Because system calls bypass the CPU privilege checks is false; system calls enforce privilege checks via mode switch.Final Answer:
Option A -> Option AQuick Check:
Mode switch overhead limits system call usage [OK]
- Believing system calls cannot access hardware
- Thinking user mode has full kernel access
- Assuming system calls skip privilege checks
