B CompE Bachelor of Computer Engineering Bachelor of Computer Engineering Operating System 2 โ Questions and Answers
Question 1: Which page replacement algorithm suffers from Belady's anomaly, where adding more frames can increase page faults?
- LRU
- FIFO (Correct answer)
- Optimal
- Clock
Correct answer: FIFO
FIFO is the classic algorithm known to exhibit Belady's anomaly, where increasing physical frames can paradoxically raise the page fault count.
Question 2: In a Unix-like OS, which system call creates a new process that is an exact copy of the calling process?
- exec()
- spawn()
- fork() (Correct answer)
- clone()
Correct answer: fork()
fork() duplicates the calling process, giving the child an identical copy of the parent's address space, file descriptors, and registers.
Question 3: What is the term for the condition where a process holds one resource and waits for another held by a second process, which in turn waits for the first?
- Starvation
- Livelock
- Deadlock (Correct answer)
- Race condition
Correct answer: Deadlock
Deadlock occurs when two or more processes are each waiting for a resource held by another, forming a circular wait with no progress possible.
Question 4: Which scheduling metric measures the ratio of burst time to turnaround time, used in the HRRN algorithm?
- CPU utilization
- Response ratio (Correct answer)
- Throughput
- Waiting ratio
Correct answer: Response ratio
HRRN selects the process with the highest response ratio = (waiting time + burst time) / burst time to prevent starvation.
Question 5: In virtual memory systems, what structure maps virtual page numbers to physical frame numbers?
- Segment table
- Page table (Correct answer)
- TLB
- Inverted page table
Correct answer: Page table
The page table maintained per-process translates virtual page numbers into the corresponding physical frame numbers for address translation.
Question 6: Which inter-process communication mechanism allows a fixed-size buffer shared between producer and consumer processes, typically implemented in the kernel?
- Pipe
- Socket
- Shared memory
- Message queue (Correct answer)
Correct answer: Message queue
Message queues store messages in a kernel-managed queue with defined capacity, decoupling producers and consumers without requiring shared memory mapping.
Question 7: What technique does an OS use to allow a program larger than physical RAM to run by keeping only active portions in memory?
- Swapping
- Compaction
- Demand paging (Correct answer)
- Fragmentation
Correct answer: Demand paging
Demand paging loads pages into RAM only when they are accessed, generating a page fault on first reference and retrieving them from disk.
Which page replacement algorithm suffers from Belady's anomaly, where adding more frames can increase page faults?