B CompE Bachelor of Computer Engineering Bachelor of Computer Engineering Operating System 3 — Questions and Answers
Question 1: Which type of kernel runs most OS services in user space, communicating via message passing, improving fault isolation?
- Monolithic kernel
- Microkernel (Correct answer)
- Hybrid kernel
- Exokernel
Correct answer: Microkernel
A microkernel keeps only essential functions (IPC, basic scheduling, memory management) in kernel space, running drivers and services as user-space processes.
Question 2: In POSIX threads, which function blocks the calling thread until the target thread terminates and retrieves its exit status?
- pthread_exit()
- pthread_cancel()
- pthread_join() (Correct answer)
- pthread_detach()
Correct answer: pthread_join()
pthread_join() suspends the caller until the specified thread finishes, then reclaims the thread's resources and retrieves its return value.
Question 3: What is the primary purpose of the Translation Lookaside Buffer (TLB) in a paged memory system?
- Store recently used disk blocks
- Cache recent virtual-to-physical address translations (Correct answer)
- Hold the page replacement policy state
- Buffer DMA transfers
Correct answer: Cache recent virtual-to-physical address translations
The TLB is a small, fast hardware cache that stores recent page table entries to avoid costly main-memory page table lookups on every memory access.
Question 4: Which disk scheduling algorithm services requests in one direction until the end of the disk, then reverses — minimizing maximum wait time?
- FCFS
- SSTF
- SCAN (Elevator) (Correct answer)
- C-SCAN
Correct answer: SCAN (Elevator)
The SCAN (elevator) algorithm moves the disk arm in one direction servicing all pending requests, then reverses direction, similar to an elevator.
Question 5: In the context of semaphores, what does a binary semaphore initialized to 1 primarily enforce?
- Counting available resources
- Mutual exclusion on a critical section (Correct answer)
- Process ordering
- Deadlock prevention
Correct answer: Mutual exclusion on a critical section
A binary semaphore initialized to 1 acts as a mutex: wait() acquires it (sets to 0) and signal() releases it (sets to 1), ensuring only one process enters the critical section.
Question 6: Which file system allocation method suffers the most from external fragmentation, requiring periodic compaction?
- Indexed allocation
- Linked allocation
- Contiguous allocation (Correct answer)
- FAT allocation
Correct answer: Contiguous allocation
Contiguous allocation assigns sequential disk blocks to a file; as files are created and deleted, gaps accumulate causing external fragmentation.
Question 7: What is 'thrashing' in virtual memory management?
- Excessive context switching between kernel threads
- High CPU utilization with no useful work due to constant page faults (Correct answer)
- Disk I/O saturation from large sequential reads
- TLB invalidation storms during process migration
Correct answer: High CPU utilization with no useful work due to constant page faults
Thrashing occurs when the working sets of all active processes exceed available physical memory, causing the system to spend more time paging than executing instructions.
Which type of kernel runs most OS services in user space, communicating via message passing, improving fault isolation?