BSCS Bachelor of Science in Computer Science: Operating Systems Concepts 2 — Questions and Answers
Question 1: Which page replacement algorithm suffers from Belady's anomaly, where adding more frames can increase page faults?
- LRU (Least Recently Used)
- FIFO (First-In, First-Out) (Correct answer)
- Optimal
- Clock
Correct answer: FIFO (First-In, First-Out)
FIFO is the classic algorithm known to exhibit Belady's anomaly, where increasing the number of frames can paradoxically increase page faults.
Question 2: In a system using the banker's algorithm, a process is granted a resource only if the resulting state is:
- Deadlocked
- Safe (Correct answer)
- Blocked
- Starvation-free
Correct answer: Safe
The banker's algorithm grants resources only when the resulting system state is safe, meaning there exists at least one sequence in which all processes can finish.
Question 3: What is the primary purpose of a Translation Lookaside Buffer (TLB) in virtual memory systems?
- To store recently accessed pages from disk
- To cache recent virtual-to-physical address mappings (Correct answer)
- To manage free frame lists
- To handle page faults
Correct answer: To cache recent virtual-to-physical address mappings
The TLB is a hardware cache that stores recent virtual-to-physical page number translations to speed up memory access.
Question 4: Which of the following is a characteristic of a monolithic kernel?
- Each service runs in its own protected user-space process
- All OS services run in kernel space and share the same address space (Correct answer)
- Only memory management runs in kernel mode
- Device drivers are always loaded dynamically
Correct answer: All OS services run in kernel space and share the same address space
A monolithic kernel runs all OS services—file systems, device drivers, scheduling—together in a single kernel address space.
Question 5: In the context of disk scheduling, what does LOOK differ from SCAN?
- LOOK services requests in random order
- LOOK reverses direction at the last request rather than at the disk end (Correct answer)
- LOOK always starts from the innermost track
- LOOK only moves in one direction
Correct answer: LOOK reverses direction at the last request rather than at the disk end
Unlike SCAN (which goes to the physical end of the disk), LOOK reverses direction at the last pending request in each sweep.
Question 6: A race condition occurs when:
- Two processes finish in the exact same CPU cycle
- The outcome depends on the non-deterministic order of concurrent operations (Correct answer)
- A process monopolizes the CPU without releasing it
- The scheduler preempts a process before it finishes I/O
Correct answer: The outcome depends on the non-deterministic order of concurrent operations
A race condition exists when the final result depends on the relative timing or interleaving of operations by concurrent processes or threads.
Question 7: What problem can arise if a low-priority process holds a resource needed by a high-priority process?
- Deadlock
- Thrashing
- Priority inversion (Correct answer)
- Starvation
Correct answer: Priority inversion
Priority inversion occurs when a higher-priority process is blocked waiting for a resource held by a lower-priority process.
Which page replacement algorithm suffers from Belady's anomaly, where adding more frames can increase page faults?