IKM Operating Systems — Questions and Answers
Question 1: Which scheduling algorithm gives each process an equal time slice in circular order?
- First Come First Served
- Shortest Job First
- Round Robin (Correct answer)
- Priority Scheduling
Correct answer: Round Robin
Round Robin assigns a fixed time quantum to each process in circular order.
Round Robin is a preemptive algorithm ideal for time-sharing systems. Each process gets a fixed time slice, typically 10-100ms. When the quantum expires, the process moves to the back of the ready queue.
Question 2: What is the primary purpose of virtual memory?
- Increase CPU speed
- Allow programs to use more memory than physically available (Correct answer)
- Compress files on disk
- Manage user authentication
Correct answer: Allow programs to use more memory than physically available
Virtual memory uses disk space as an extension of RAM, enabling programs to address more memory than physically installed.
Virtual memory uses RAM and disk (swap/page file) to present a larger address space. The MMU translates virtual to physical addresses using page tables. Page faults trigger loading data from disk.
Question 3: Which file system is the default for modern Linux distributions?
- NTFS
- FAT32
- ext4 (Correct answer)
- HFS+
Correct answer: ext4
ext4 is the default file system for most modern Linux distributions, offering journaling and large file support.
ext4 supports volumes up to 1 exbibyte and files up to 16 tebibytes. It includes journaling, extents, delayed allocation, and backward compatibility with ext2/ext3.
Question 4: What is a deadlock in operating systems?
- Infinite loop
- Two or more processes waiting for resources held by each other (Correct answer)
- CPU overheating
- Disk read error
Correct answer: Two or more processes waiting for resources held by each other
A deadlock occurs when processes are permanently blocked, each waiting for a resource held by another.
Deadlock requires four Coffman conditions. Strategies include prevention (break a condition), avoidance (Banker's algorithm), detection and recovery, or ignoring it (ostrich algorithm).
Question 5: Which system call creates a new process in Unix/Linux?
- exec()
- fork() (Correct answer)
- spawn()
- create()
Correct answer: fork()
fork() creates a child process that is a copy of the parent process.
fork() creates a child with a new PID but copies the parent's address space using copy-on-write. It returns 0 to the child and the child's PID to the parent. Typically followed by exec().
Question 6: What is the purpose of a semaphore?
- Measure CPU temperature
- Synchronize access to shared resources between processes (Correct answer)
- Manage disk partitions
- Handle network routing
Correct answer: Synchronize access to shared resources between processes
A semaphore controls access to shared resources using wait and signal operations.
Semaphores use an integer counter with atomic wait (P) and signal (V) operations. Binary semaphores allow one process at a time. Counting semaphores allow up to N concurrent accesses.
Question 7: What is the difference between a process and a thread?
- Threads are always faster
- Processes have separate address spaces; threads share the same address space (Correct answer)
- Threads cannot access shared memory
- Processes run in user mode only
Correct answer: Processes have separate address spaces; threads share the same address space
Processes have independent memory spaces while threads share code, data, and heap.
A process has its own virtual address space and resources. Threads within a process share code, data, and heap but have their own stack and program counter. Thread creation and context switching is faster.
Question 8: Which page replacement algorithm is optimal but impractical?
- FIFO
- LRU
- Optimal (Belady's) (Correct answer)
- Clock
Correct answer: Optimal (Belady's)
Belady's Optimal algorithm replaces the page not used for the longest future time, requiring future knowledge.
The Optimal algorithm produces the fewest page faults by replacing the page not referenced for the longest period. Since it requires foreknowledge of future accesses, it serves only as a benchmark.
Question 9: What is the primary advantage of a microkernel over a monolithic kernel?
- Higher raw performance
- Better modularity and fault isolation (Correct answer)
- Simpler driver development
- Lower memory usage
Correct answer: Better modularity and fault isolation
Microkernels move drivers and services to user space, providing better fault isolation.
Microkernels keep only essential functions in kernel space. Drivers and file systems run as user-space processes. A crashing driver does not crash the kernel. The tradeoff is IPC performance overhead.
Question 10: What is thrashing in virtual memory?
- Rapid file deletion
- Excessive page faulting that severely degrades performance (Correct answer)
- Kernel buffer overflow
- Hard drive failure
Correct answer: Excessive page faulting that severely degrades performance
Thrashing occurs when the system spends more time swapping pages than executing instructions.
Thrashing happens when active processes' working sets exceed available memory. The OS continuously pages out and in, saturating disk I/O while CPU utilization drops.
Question 11: Which I/O scheduling algorithm services requests in arrival order?
- SCAN
- C-SCAN
- FCFS (Correct answer)
- SSTF
Correct answer: FCFS
FCFS processes disk I/O requests in the order received.
FCFS is the simplest but does not optimize for seek time. SSTF reduces average seek time but may starve distant requests. SCAN and C-SCAN provide more uniform service.
Question 12: What is the role of the bootloader?
- Compile the kernel
- Load the OS kernel into memory and start execution (Correct answer)
- Format the boot partition
- Establish network connectivity
Correct answer: Load the OS kernel into memory and start execution
The bootloader loads the kernel from storage into RAM and transfers control to it.
BIOS/UEFI initializes hardware and finds a bootable device. The bootloader (e.g., GRUB) loads the kernel image, passes boot parameters, and transfers execution. UEFI systems use Secure Boot.
Question 13: Which page replacement algorithm can suffer from Belady's anomaly, where adding more frames increases page faults?
- Least Recently Used (LRU)
- Optimal (OPT)
- First-In, First-Out (FIFO) (Correct answer)
- Least Frequently Used with aging
Correct answer: First-In, First-Out (FIFO)
FIFO is not a stack algorithm, so more frames can occasionally produce more page faults.
Question 14: A low-priority task holds a mutex needed by a high-priority task while a medium-priority task preempts it. Which technique best resolves this?
- Priority inheritance (Correct answer)
- Round-robin time slicing
- Increasing the mutex timeout
- Aging the medium-priority task
Correct answer: Priority inheritance
Priority inheritance temporarily raises the lock holder's priority so it can finish and release the mutex.
Question 15: Immediately after a UNIX fork() on a modern system using copy-on-write, what happens to the parent's memory pages?
- All pages are physically duplicated for the child
- Pages are shared read-only and copied only when either process writes (Correct answer)
- The child receives only the stack; heap pages are unmapped
- The parent's pages are swapped out until the child calls exec()
Correct answer: Pages are shared read-only and copied only when either process writes
Copy-on-write defers physical copying until a write fault occurs on a shared page.
Question 16: A process has exited but still appears in the process table with state 'Z'. What is the most likely cause?
- It is blocked waiting on disk I/O
- It was adopted by init and is still running
- It is stopped by a SIGSTOP signal
- Its parent has not yet called wait() to collect its exit status (Correct answer)
Correct answer: Its parent has not yet called wait() to collect its exit status
A zombie keeps its process-table entry until the parent reaps it with wait() or waitpid().
Question 17: What does a Translation Lookaside Buffer (TLB) cache?
- Recently used disk blocks
- Virtual-to-physical address translations (Correct answer)
- Open file descriptors per process
- Interrupt vector addresses
Correct answer: Virtual-to-physical address translations
The TLB stores recent page-table entries so address translation avoids extra memory accesses.
Question 18: A system shows very high disk activity and low CPU utilization because processes constantly page in and out. Which approach most directly addresses this?
- Increase the degree of multiprogramming
- Switch the scheduler from SJF to round-robin
- Reduce the number of active processes based on their working sets (Correct answer)
- Increase the time quantum
Correct answer: Reduce the number of active processes based on their working sets
Thrashing is relieved by ensuring each active process's working set fits in memory, often by suspending processes.
Question 19: The Banker's algorithm is an example of which deadlock strategy?
- Deadlock avoidance (Correct answer)
- Deadlock prevention
- Deadlock detection and recovery
- Deadlock ignorance (ostrich algorithm)
Correct answer: Deadlock avoidance
It grants requests only if the resulting state is safe, avoiding deadlock dynamically.