BSCS Bachelor of Science in Computer Science: Operating Systems Concepts 4 — Questions and Answers
Question 1: A semaphore initialized to 1 and used to protect a critical section is called a:
- Counting semaphore
- Binary semaphore (mutex semaphore) (Correct answer)
- Spin lock
- Monitor
Correct answer: Binary semaphore (mutex semaphore)
A binary semaphore (or mutex semaphore) takes only values 0 and 1 and is used to enforce mutual exclusion in a critical section.
Question 2: What is the main advantage of using a microkernel architecture over a monolithic kernel?
- Higher performance due to fewer context switches
- Greater reliability because services run in isolated user-space processes (Correct answer)
- Simpler device driver development
- Smaller number of system calls
Correct answer: Greater reliability because services run in isolated user-space processes
In a microkernel, OS services run as user-space servers, so a failing component cannot crash the entire kernel, improving fault isolation.
Question 3: In a multi-level feedback queue (MLFQ) scheduler, a process that uses its entire time quantum is typically:
- Promoted to a higher-priority queue
- Moved to a lower-priority queue (Correct answer)
- Terminated
- Blocked in the I/O queue
Correct answer: Moved to a lower-priority queue
CPU-bound processes that exhaust their time quantum are demoted to lower-priority queues so interactive, I/O-bound jobs remain responsive.
Question 4: The concept of 'copy-on-write' (COW) after fork() means that:
- The child immediately copies all parent pages into new frames
- Child and parent share pages until one of them writes, triggering a private copy (Correct answer)
- The parent's pages are invalidated after fork()
- Only code pages are shared; data pages are always duplicated
Correct answer: Child and parent share pages until one of them writes, triggering a private copy
COW defers page duplication until a write occurs, so processes that exec() immediately after fork() never copy the parent's data, saving memory and time.
Question 5: Which condition is NOT one of the four necessary conditions for deadlock?
- Mutual exclusion
- Preemption (Correct answer)
- Hold and wait
- Circular wait
Correct answer: Preemption
Preemption (the ability to forcibly take a resource from a process) is actually a condition whose absence enables deadlock, not one of the four necessary conditions.
Question 6: In a Unix filesystem, an inode stores all of the following EXCEPT:
- File permissions and ownership
- Timestamps (created, modified, accessed)
- The filename (Correct answer)
- Pointers to data blocks
Correct answer: The filename
Filenames are stored in directory entries that map names to inode numbers; the inode itself contains metadata and block pointers but not the name.
Question 7: What distinguishes preemptive scheduling from non-preemptive scheduling?
- Preemptive scheduling only works with batch jobs
- The OS can forcibly remove a running process from the CPU before it completes or blocks (Correct answer)
- Non-preemptive scheduling requires hardware support
- Preemptive scheduling does not use a ready queue
Correct answer: The OS can forcibly remove a running process from the CPU before it completes or blocks
In preemptive scheduling, the OS can interrupt a running process—typically on a timer interrupt or when a higher-priority process arrives—and reassign the CPU.
A semaphore initialized to 1 and used to protect a critical section is called a: