Operating Systems MCQ
Test your Operating Systems knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.
How This Practice Test Works
Every question below expands right on this page — click a question to reveal its four options, pick the one you think is correct, and you'll get instant feedback along with the correct answer and a short explanation of the reasoning. Questions are grouped by difficulty, so start with the 40 beginner questions to confirm your fundamentals, work through the 40 intermediate ones, and finish with the 20 advanced questions that mirror what exams and technical screenings actually ask. There's no sign-up, no timer, and no limit — retake the test as often as you like.
Curated by Tech Baithak Editorial Team · Last updated: June 2026
1
What is an operating system?
Correct Answer
System software that manages hardware resources and provides services to application programs
Explanation
An OS acts as an intermediary between user programs and hardware, managing CPU, memory, I/O devices, and files while providing abstractions like processes, files, and sockets.
2
What is a process?
Correct Answer
An instance of a program in execution with its own address space and resources
Explanation
A process is a running program with its own virtual address space, stack, heap, code, data, open files, and CPU registers state.
3
What is a thread?
Correct Answer
A lightweight process that shares address space with other threads in the same process
Explanation
Threads (lightweight processes) share code, data, and open files with other threads in the same process but have their own stack and registers.
4
What is virtual memory?
Correct Answer
A memory management technique that gives each process its own large address space, mapping to physical memory and disk as needed
Explanation
Virtual memory abstracts physical memory, giving each process its own address space. Pages not in RAM are swapped to disk (paging/swapping).
5
What is a system call?
Correct Answer
A request by a user program to the OS kernel to perform a privileged operation
Explanation
System calls (read, write, fork, exec, open) are the interface between user programs and the OS kernel, requiring a mode switch from user to kernel mode.
6
What is context switching?
Correct Answer
Saving the CPU state of one process and loading another process's state to allow multitasking
Explanation
Context switching saves the running process's registers, PC, and state to its PCB, then restores another process's PCB. It is the mechanism enabling multitasking.
7
What does CPU scheduling decide?
Correct Answer
Which process gets to run on the CPU next and for how long
Explanation
CPU scheduling selects which ready process runs next. Goals include maximizing CPU utilization, throughput, and minimizing wait time, turnaround time, and response time.
8
What is deadlock?
Correct Answer
A situation where two or more processes are blocked, each waiting for a resource held by another
Explanation
Deadlock requires all four Coffman conditions simultaneously: mutual exclusion, hold-and-wait, no preemption, and circular wait.
9
What is a semaphore?
Correct Answer
A synchronization primitive with atomic wait (P) and signal (V) operations to control access to shared resources
Explanation
Semaphores have an integer value. Wait (P) decrements and blocks if negative; Signal (V) increments and wakes a blocked process. Binary semaphores are essentially mutexes.
10
What is paging in memory management?
Correct Answer
Dividing physical memory into fixed-size frames and virtual memory into pages of the same size, mapping pages to frames via page tables
Explanation
Paging eliminates external fragmentation. A page table maps virtual page numbers to physical frame numbers. The MMU and TLB accelerate address translation.
11
What is the difference between preemptive and non-preemptive scheduling?
Correct Answer
Preemptive allows the OS to forcibly take the CPU from a running process; non-preemptive only switches when a process voluntarily yields
Explanation
Preemptive scheduling (SRTF, Round Robin) allows the OS to interrupt a running process. Non-preemptive (FCFS, SJF non-preemptive) waits until the process blocks or finishes.
12
What is the role of the Process Control Block (PCB)?
Correct Answer
Storing all information about a process: state, registers, memory maps, open files, and scheduling info
Explanation
The PCB (task control block) is the OS's data structure for a process. It is saved/restored during context switches.
13
What is a page fault?
Correct Answer
An interrupt raised when a process accesses a virtual page not currently in physical memory
Explanation
A page fault triggers the OS page fault handler, which loads the missing page from disk into a physical frame, possibly evicting another page.
14
What is a file system?
Correct Answer
The OS component that organizes and manages files on storage devices, providing naming, directories, and access control
Explanation
File systems (ext4, NTFS, APFS, FAT32) provide hierarchical directories, file naming, metadata, and access control on disk.
15
What is the difference between internal and external fragmentation?
Correct Answer
Internal: wasted space within an allocated block; External: free memory scattered in small pieces between allocations
Explanation
Internal fragmentation: allocated block is larger than needed (paging). External fragmentation: total free memory is enough but not contiguous (segmentation, variable partitioning).
16
What is the FCFS (First Come First Serve) scheduling algorithm?
Correct Answer
Schedule processes in the order they arrive in the ready queue — simple but can cause the convoy effect
Explanation
FCFS is non-preemptive and simple. The convoy effect occurs when a long process delays short ones, causing high average wait time.
17
What is the Round Robin scheduling algorithm?
Correct Answer
A preemptive algorithm giving each process a fixed time quantum (time slice), then moving to the next
Explanation
Round Robin is fair and widely used in time-sharing systems. Performance depends heavily on time quantum: too small → high context-switch overhead; too large → behaves like FCFS.
18
What is the difference between multiprogramming and multitasking?
Correct Answer
Multiprogramming keeps CPU busy by running multiple programs; multitasking adds rapid switching (time-sharing) for interactive response
Explanation
Multiprogramming: when one process waits for I/O, another runs (maximizes CPU usage). Multitasking: time-sliced switching creates illusion of simultaneity for interactive users.
19
What is a mutex?
Correct Answer
A mutual exclusion lock that only the thread that acquired it can release, preventing concurrent access to a critical section
Explanation
A mutex (mutual exclusion) ensures only one thread enters a critical section at a time. Unlike binary semaphores, ownership is enforced — only the locking thread can unlock.
20
What is thrashing in operating systems?
Correct Answer
A state where the OS spends more time paging than executing processes due to insufficient physical memory
Explanation
Thrashing occurs when too many processes compete for physical memory, causing constant page faults and swapping, making CPU utilization drop near zero.
21
What does fork() do in Unix/Linux?
Correct Answer
Creates a new child process as a copy of the parent, returning 0 to child and the child's PID to parent
Explanation
fork() duplicates the calling process. Parent gets child's PID (>0); child gets 0. Both continue executing from the point after fork(). exec() replaces the process image.
22
What is the Producer-Consumer problem?
Correct Answer
A classic synchronization problem where producers add items to a bounded buffer and consumers remove them, requiring coordination
Explanation
The producer-consumer (bounded buffer) problem requires synchronization with semaphores: empty (count of free slots), full (count of filled slots), and mutex for buffer access.
23
What is segmentation in memory management?
Correct Answer
Dividing a program's address space into variable-size logical segments (code, stack, heap, data)
Explanation
Segmentation maps logical segments to physical memory. It causes external fragmentation. Combined with paging (segmented paging) is used in x86 protected mode.
24
What is the difference between kernel mode and user mode?
Correct Answer
Kernel mode has full hardware access and runs OS code; user mode is restricted and runs application code
Explanation
The CPU runs in privileged kernel mode for OS code (full hardware access) and unprivileged user mode for applications. System calls trigger a mode switch via software interrupt or SYSCALL.
25
What is the Least Recently Used (LRU) page replacement policy?
Correct Answer
Replace the page that has not been used for the longest time
Explanation
LRU approximates OPT (optimal) by replacing the least recently used page. It is theoretically good but expensive to implement exactly; approximations (clock algorithm) are used in practice.
26
What is an inode in Unix file systems?
Correct Answer
A data structure storing a file's metadata (permissions, timestamps, data block pointers) but not its name
Explanation
Inodes store file metadata and pointers to data blocks. Directory entries map filenames to inode numbers. Hard links share the same inode; symbolic links have their own inode pointing to a path.
27
What is swapping in memory management?
Correct Answer
Moving an entire process from RAM to disk (swap space) to free physical memory for other processes
Explanation
Swapping moves entire processes to disk to free RAM. Modern OSes use demand paging (swap individual pages) instead of whole-process swapping for efficiency.
28
What is the banker's algorithm used for?
Correct Answer
Deadlock avoidance by checking if resource allocation leaves the system in a safe state
Explanation
The Banker's Algorithm (Dijkstra) checks if granting a resource request would leave the system in a safe state (a state where all processes can eventually complete). If not, the request is denied.
29
What is an interrupt?
Correct Answer
A hardware or software signal causing the CPU to stop current execution and handle the event via an interrupt service routine
Explanation
Interrupts allow I/O devices to notify the CPU asynchronously. The CPU saves context, jumps to the ISR, handles the event, and resumes. Enables efficient I/O without busy-waiting.
30
What is DMA (Direct Memory Access)?
Correct Answer
A mechanism allowing I/O devices to transfer data directly to/from memory without CPU involvement, freeing the CPU for other tasks
Explanation
DMA controllers handle bulk data transfers between I/O devices and memory. The CPU initializes the transfer, then continues executing until the DMA controller fires a completion interrupt.
31
What is a race condition?
Correct Answer
When multiple processes access shared data concurrently and the outcome depends on execution order
Explanation
Race conditions produce unpredictable results when concurrent processes share data without proper synchronization. Prevented by critical sections, mutexes, and semaphores.
32
What is the critical section problem?
Correct Answer
Ensuring that only one process at a time executes code that accesses shared resources
Explanation
The critical section is code accessing shared resources. A solution must satisfy mutual exclusion, progress, and bounded waiting to prevent race conditions and starvation.
33
What is the purpose of the TLB (Translation Lookaside Buffer)?
Correct Answer
A fast hardware cache for recently used page table entries, speeding up virtual-to-physical address translation
Explanation
Without TLB, every memory access requires multiple page table lookups. The TLB caches recent translations, achieving near-hardware-speed memory access most of the time.
34
What is a zombie process?
Correct Answer
A terminated process whose exit status has not been collected by its parent — its PCB remains in the process table
Explanation
When a child exits, its PCB stays until the parent calls wait(). Until then, it's a zombie. Orphan processes (parent exits first) are adopted by init/PID 1.
35
What is a monolithic kernel vs a microkernel?
Correct Answer
Monolithic kernel runs all OS services in kernel mode; microkernel moves most services to user space for better isolation
Explanation
Monolithic kernels (Linux, Windows) are fast but a driver bug can crash the OS. Microkernels (Mach, L4, seL4) are more secure/reliable but have higher IPC overhead.
36
What is the Shortest Job First (SJF) scheduling algorithm?
Correct Answer
Schedule the process with the shortest next CPU burst, minimizing average wait time
Explanation
SJF is optimal for minimizing average wait time but requires knowing burst lengths in advance (estimated via exponential averaging for prediction). Preemptive SJF is called SRTF.
37
What is inter-process communication (IPC)?
Correct Answer
Mechanisms allowing processes to exchange data and synchronize: pipes, message queues, shared memory, sockets
Explanation
IPC mechanisms: anonymous pipes (parent-child), named pipes/FIFOs, message queues, shared memory (fastest), semaphores, sockets (network). Each offers different tradeoffs.
38
What is the purpose of the boot loader?
Correct Answer
The first program executed by firmware that loads the OS kernel from disk into memory and transfers control to it
Explanation
Boot loaders (GRUB, Windows Boot Manager) are loaded by BIOS/UEFI from the boot sector. They load and start the OS kernel, enabling multi-boot configurations.
39
What is copy-on-write (COW) in operating systems?
Correct Answer
Deferring the copy of a shared resource until a process actually modifies it, reducing unnecessary copying (used in fork())
Explanation
After fork(), parent and child share physical pages marked read-only. On a write, the OS creates a private copy just for that page. This makes fork() efficient.
40
What does it mean for a process to be in the "ready" state?
Correct Answer
The process has all the resources it needs and is waiting only for the CPU to be assigned to it
Explanation
A ready process is loaded in memory and able to run immediately once the scheduler picks it; it just isn't currently holding the CPU. This differs from "running" (has the CPU) and "blocked/waiting" (needs an event like I/O completion).
1
What are the four Coffman conditions for deadlock?
Correct Answer
Mutual exclusion, hold-and-wait, no preemption, and circular wait — all must hold simultaneously for deadlock
Explanation
All four conditions are necessary for deadlock. Breaking any one prevents it: allow preemption, use resource ordering (prevent circular wait), or detect and recover.
2
What is the difference between a binary semaphore and a counting semaphore?
Correct Answer
Binary semaphore has value 0 or 1 (mutex-like); counting semaphore can have any non-negative value (managing a resource pool)
Explanation
Binary semaphore: 0 (locked) or 1 (unlocked). Counting semaphore: tracks a resource count (e.g., available buffer slots in producer-consumer). Signal increments; Wait decrements.
3
What is the working set model for virtual memory?
Correct Answer
The set of pages a process is actively using in a recent time window — used to prevent thrashing by ensuring each process has its working set in memory
Explanation
Denning's working set model tracks pages referenced in the last Δ time units. If total working sets exceed physical memory, processes are swapped out, preventing thrashing.
4
What is the difference between hard links and symbolic links?
Correct Answer
Hard links share an inode directly; symbolic links store a path and break if the target is deleted
Explanation
Hard links: multiple directory entries pointing to the same inode. Deleting one doesn't affect the file. Symbolic (soft) links store the path — deleting the target breaks the link.
5
What is Peterson's solution and what problem does it solve?
Correct Answer
A software-only solution to the critical section problem for two processes using two shared variables
Explanation
Peterson's algorithm uses flag[] and turn variables to achieve mutual exclusion, progress, and bounded waiting for two processes without hardware support.
6
What is demand paging?
Correct Answer
Loading pages into physical memory only when they are referenced (on page fault), saving memory and startup time
Explanation
Demand paging starts processes with no pages in memory. Each page is loaded on first access. This enables running programs larger than physical RAM and faster startup.
7
What is the clock (second-chance) page replacement algorithm?
Correct Answer
An LRU approximation using a circular buffer and reference bits — pages get a second chance if their reference bit is set
Explanation
The clock algorithm traverses pages in circular order. If reference bit=1, clear it and move on (second chance). If 0, replace it. This approximates LRU efficiently.
8
What is priority inversion?
Correct Answer
When a high-priority process is blocked by a low-priority process holding a resource needed by the high-priority process
Explanation
Priority inversion: high-P task waits for a lock held by low-P task. If medium-P tasks run meanwhile, high-P is indefinitely delayed. Solved by priority inheritance (Mars Pathfinder bug).
9
What is the multi-level feedback queue (MLFQ) scheduler?
Correct Answer
A scheduler with multiple queues of decreasing priority, demoting CPU-intensive processes and promoting I/O-bound processes dynamically
Explanation
MLFQ estimates process behavior: new processes start at high priority; if they use their quantum, they are demoted; if they yield early, they stay high. This approximates SJF without knowing burst times.
10
What is the Completely Fair Scheduler (CFS) in Linux?
Correct Answer
Linux's default scheduler tracking "virtual runtime" for each process using a red-black tree to always schedule the process with least virtual runtime
Explanation
CFS models an ideal multi-tasking CPU. It uses vruntime (wall time scaled by nice value) and a red-black tree, picking the leftmost node (lowest vruntime) as the next to run.
11
What is the difference between eager and lazy loading in virtual memory?
Correct Answer
Eager loads all pages at process start; lazy (demand paging) loads only when referenced
Explanation
Eager (prepaging) loads pages into memory proactively. Demand paging (lazy) loads pages only on fault. Modern systems use demand paging with working-set prefetching.
12
What is a page table walk and what is the multi-level page table?
Correct Answer
Traversing hierarchical page tables (2/3/4 levels) to translate a virtual address, reducing page table size for sparse address spaces
Explanation
A 4-level page table (x86-64: PML4, PDPT, PD, PT) only allocates subtables for used address ranges, handling the 48-bit virtual address space without a 512GB flat page table.
13
What is the difference between user-level and kernel-level threads?
Correct Answer
User-level threads are managed by user library (no kernel involvement per thread); kernel-level threads are scheduled by the OS enabling true parallelism
Explanation
User threads: fast creation/switching, but one blocking syscall blocks all threads. Kernel threads: OS-managed, enabling parallel execution on multiple CPUs but with higher overhead per thread.
14
What is the POSIX specification?
Correct Answer
A family of IEEE standards defining a Unix-compatible OS API (system calls, signals, threads, file I/O)
Explanation
POSIX (Portable Operating System Interface) standardizes Unix-like OS interfaces. Programs using POSIX APIs (fork, pthread, open, read) are portable across Linux, macOS, and other Unix systems.
15
What is the reader-writer problem?
Correct Answer
A synchronization problem allowing multiple concurrent readers or one exclusive writer, balancing concurrency and consistency
Explanation
Multiple readers can share a resource simultaneously. A writer needs exclusive access. Solutions favor readers (risk starving writers) or writers (risk starving readers), or use fair algorithms.
16
What is the difference between a process scheduler and a memory scheduler?
Correct Answer
Process scheduler determines CPU allocation; memory scheduler (medium-term scheduler) decides which processes are swapped in/out of memory
Explanation
Three scheduler levels: long-term (job scheduler, admits to ready queue), short-term (CPU scheduler, picks next to run), medium-term (swaps processes for multiprogramming degree control).
17
What is the journaling file system?
Correct Answer
A file system that writes changes to a journal (log) before applying them, enabling fast recovery after crashes
Explanation
Journaling (ext3, ext4, NTFS) writes a transaction to a log first. On crash, replaying the journal restores consistency in seconds instead of running fsck on the entire disk.
18
What is the dining philosophers problem?
Correct Answer
A classic synchronization problem illustrating deadlock and starvation: 5 philosophers need 2 forks (chopsticks) but only 5 are available
Explanation
Five philosophers alternate thinking and eating. Each needs two adjacent forks. Naive grab-one-fork leads to deadlock. Solutions: allow at most 4 to try simultaneously, ordered acquisition, or arbitration.
19
What is Belady's anomaly?
Correct Answer
The counter-intuitive phenomenon where increasing the number of page frames causes more page faults in FIFO replacement
Explanation
FIFO replacement exhibits Belady's anomaly: more frames can cause more faults. LRU and OPT are stack algorithms (not susceptible to this anomaly).
20
What is the difference between preemptive and cooperative multitasking?
Correct Answer
Preemptive: OS forcibly takes control; Cooperative: processes voluntarily yield — early Windows/Mac used cooperative, modern OSes use preemptive
Explanation
Cooperative multitasking relies on programs to yield. One buggy or greedy program freezes the system. Preemptive multitasking uses timer interrupts to forcibly switch, ensuring fairness.
21
What is the difference between a spinlock and a mutex?
Correct Answer
Spinlocks use busy-waiting; mutexes block and yield the CPU
Explanation
Spinlocks busy-wait (spin) in a loop until acquired — efficient for very short waits on multi-core but wasteful for long waits. Mutexes block the thread, yielding the CPU.
22
What is a virtual file system (VFS)?
Correct Answer
An abstraction layer in the kernel providing a uniform interface to different concrete file systems (ext4, NTFS, FAT, NFS)
Explanation
VFS (in Linux/Unix) defines common data structures (super_block, inode, dentry, file) and operations. Concrete file systems implement these, allowing transparent access from user space.
23
What is the purpose of the init process (PID 1)?
Correct Answer
The first user-space process started by the kernel that adopts orphan processes and starts system services
Explanation
init/systemd (PID 1) is the ancestor of all user-space processes. It starts services and adopts orphan processes (whose parent died) to prevent zombie accumulation.
24
What is CPU affinity and how does it relate to NUMA-aware scheduling?
Correct Answer
Binding a process to specific CPUs and scheduling threads near their memory nodes to reduce remote memory access latency
Explanation
CPU affinity (sched_setaffinity) pins a process to particular CPU(s), improving cache reuse. NUMA-aware schedulers extend this by keeping threads close to the memory node they access most, avoiding costly remote-node latency.
25
How does the Shortest Remaining Time First (SRTF) algorithm differ from non-preemptive SJF?
Correct Answer
SRTF can preempt the running process if a newly arrived process has a shorter remaining burst time, while non-preemptive SJF runs a chosen process to completion
Explanation
SRTF is the preemptive version of SJF: whenever a new process arrives with a shorter remaining time than the currently running one, the CPU is taken away and given to the new process, which can reduce average waiting time further at the cost of more context switches.
26
Why can strict "shortest job first" scheduling lead to starvation?
Correct Answer
Because a continuous stream of short jobs can keep pushing a long job to the back of the queue indefinitely
Explanation
SJF favors processes with short CPU bursts. If short jobs keep arriving, a longer job may never be selected, causing starvation. Aging — gradually increasing a waiting process's priority over time — is a common fix.
27
What problem does the "aging" technique solve in priority scheduling?
Correct Answer
It prevents starvation by gradually increasing the priority of processes that have waited a long time
Explanation
In pure priority scheduling, low-priority processes can wait indefinitely if higher-priority ones keep arriving. Aging incrementally raises the priority of waiting processes so that, eventually, every process is guaranteed to run.
28
In the producer-consumer (bounded-buffer) problem, why are two counting semaphores ("empty" and "full") needed in addition to a mutex?
Correct Answer
They track how many buffer slots are available versus occupied, so producers block when the buffer is full and consumers block when it is empty, while the mutex only protects the buffer access itself
Explanation
"empty" counts free slots and "full" counts filled slots, coordinating when producers/consumers must wait. The mutex separately ensures only one thread manipulates the shared buffer indices at a time — the three together prevent both races and incorrect blocking.
29
What is a monitor in the context of process synchronization?
Correct Answer
A high-level synchronization construct that bundles shared data with the procedures that operate on it, automatically ensuring mutual exclusion and providing condition variables
Explanation
Monitors (as in Java's synchronized methods or Pascal-style monitors) encapsulate shared data and the operations on it so that only one thread can be active inside at a time, with condition variables (wait/signal) for more complex coordination — reducing the chance of synchronization bugs compared to raw semaphores.
30
Why is the "circular wait" condition often the easiest of the four deadlock conditions to break in practice?
Correct Answer
Because imposing a global ordering on resource acquisition (processes must request resources in increasing order) prevents a cycle from ever forming, without needing special hardware
Explanation
If every process must request resources in a fixed global order, a circular chain of "waiting for" relationships can never form, eliminating circular wait. This is a practical, low-overhead strategy compared to changing mutual exclusion or preemption rules.
31
What distinguishes deadlock detection from deadlock avoidance?
Correct Answer
Detection periodically checks the system state (e.g., via a resource-allocation graph) to identify deadlocks that have already formed and then recovers; avoidance proactively decides whether granting a request keeps the system in a safe state
Explanation
Avoidance algorithms like the Banker's Algorithm decide in advance whether a resource request could ever lead to deadlock and deny risky requests. Detection algorithms let the system run and periodically check for cycles or unsafe states, then take recovery action (e.g., killing or rolling back a process).
32
How does segmentation with paging (segmented paging) combine the benefits of both schemes?
Correct Answer
It divides each segment into fixed-size pages, giving the logical view and protection benefits of segmentation while using paging to avoid external fragmentation
Explanation
Segmented paging (used in x86 protected mode) lets programmers think in terms of meaningful segments (code, data, stack) for protection and sharing, while the underlying pages of each segment are allocated in fixed-size frames, avoiding the external fragmentation that pure segmentation suffers from.
33
What is the main tradeoff when choosing a smaller versus larger time quantum in Round Robin scheduling?
Correct Answer
A smaller quantum improves responsiveness for interactive processes but increases context-switch overhead, while a larger quantum reduces overhead but makes the system behave more like FCFS
Explanation
Each context switch has a fixed overhead cost. A very small quantum spends a large fraction of CPU time switching contexts, while a very large quantum makes Round Robin degenerate toward FCFS, hurting interactive response time. A good quantum is typically chosen so most interactive bursts complete within one slice.
34
Why do modern operating systems generally prefer demand paging over loading an entire process into memory at start-up?
Correct Answer
Because it lets processes start faster, run with a smaller memory footprint, and allows the system to support more concurrent processes than physical memory could otherwise hold
Explanation
Demand paging only loads pages when they are actually referenced, so programs start quickly and use only the memory they need. This increases the degree of multiprogramming, though it does introduce page faults and, if memory is overcommitted, can still lead to thrashing.
35
What is the purpose of a "dirty bit" associated with a page table entry?
Correct Answer
It records whether a page has been modified since it was loaded, so the OS knows whether it must be written back to disk before being evicted
Explanation
When a page replacement algorithm selects a victim page, the dirty (modified) bit tells the OS whether the page's contents differ from the copy on disk. Clean pages can simply be discarded, while dirty pages must be written back first, which is more costly.
36
In a journaling file system, what is the difference between "metadata-only" journaling and "full data" journaling?
Correct Answer
Metadata-only journaling logs changes to file system structures (inodes, directories) for fast crash recovery, while full data journaling additionally logs file content changes, offering stronger consistency at the cost of more I/O overhead
Explanation
Metadata journaling (the ext4 default, "ordered" mode) protects file system structures so a crash won't corrupt directories or inode tables, recovering quickly. Full ("journal") mode also logs actual file data changes, giving stronger guarantees against data loss but roughly doubling write I/O.
37
How do message queues differ from shared memory as an inter-process communication mechanism?
Correct Answer
Message queues have the kernel manage synchronized, structured messages (simpler, more overhead); shared memory gives direct access to common memory for speed but needs manual synchronization
Explanation
With message queues, the kernel copies and queues discrete messages, handling synchronization and ordering automatically — simpler but slower due to copying and system call overhead. Shared memory avoids copying by mapping the same physical pages into multiple address spaces, which is faster but leaves synchronization (e.g., via semaphores) entirely up to the programmer.
38
What is the role of the "scheduler" component in a microkernel-based operating system compared to a monolithic one?
Correct Answer
Both decide which thread runs next, but a microkernel pushes many services into separate user-space servers, so satisfying one request needs far more scheduling and IPC than a monolithic kernel
Explanation
The fundamental scheduling job — picking the next runnable thread — is similar in both designs. The practical difference is that microkernels push file systems, drivers, and network stacks into user-space servers, so satisfying a single request may involve several context switches and IPC calls that a monolithic kernel would handle in one privileged call.
39
Why might an operating system use a "lazy" TLB invalidation strategy (such as address-space tagging with ASIDs) instead of flushing the entire TLB on every context switch?
Correct Answer
Because tagging TLB entries with an address-space identifier lets entries from multiple processes coexist in the TLB, avoiding the cost of repopulating it from scratch after every switch and reducing the number of TLB misses
Explanation
Without ASIDs, the TLB must be fully flushed on each context switch to avoid one process using another's stale translations, causing a burst of TLB misses afterward. ASID-tagged TLBs let entries from several address spaces coexist safely, so a process returning to the CPU can often still find its translations cached.
40
What is "priority donation" (or priority inheritance) and what problem does it directly address?
Correct Answer
It temporarily raises the priority of a lower-priority thread holding a lock to match the priority of a higher-priority thread waiting for that lock, addressing priority inversion
Explanation
Priority inheritance temporarily boosts the priority of the lock-holding thread to that of the highest-priority thread blocked on the same lock. This prevents medium-priority threads from indefinitely delaying the high-priority thread — the exact issue that caused the Mars Pathfinder reset bug.
1
What is the difference between hardware and software TLB management?
Correct Answer
Hardware-managed TLBs: MMU handles misses automatically using hardware page walks; software-managed TLBs: OS handles TLB misses via exception handlers (MIPS, SPARC)
Explanation
x86 uses hardware page walks (CR3 → page tables → TLB fill). MIPS uses software-managed TLBs (TLB miss → exception → OS fills TLB). Software TLBs are flexible; hardware are faster.
2
What is kernel-bypass networking (e.g., DPDK)?
Correct Answer
User-space networking that bypasses the OS kernel for packet processing, reducing latency by avoiding system calls and context switches
Explanation
DPDK (Data Plane Development Kit) maps NIC registers into user space. Polling instead of interrupts and lockless data structures achieve single-digit microsecond packet processing at line rate.
3
What is the seL4 microkernel and its significance?
Correct Answer
A formally verified microkernel with machine-checked proofs of functional correctness, security properties, and worst-case execution time bounds
Explanation
seL4 (2009) was the first OS kernel with complete formal verification of implementation correctness, proving no bugs like buffer overflows, undefined behavior, or security violations.
4
What is memory-mapped I/O vs port-mapped I/O?
Correct Answer
Memory-mapped I/O maps device registers into the address space (accessed with regular load/store); port-mapped I/O uses dedicated IN/OUT instructions
Explanation
MMIO (memory-mapped I/O) maps device registers as memory addresses, enabling C pointer access. PMIO uses dedicated I/O instructions (IN/OUT on x86). Modern systems primarily use MMIO.
5
What is the exokernel architecture?
Correct Answer
An OS design exposing hardware resources directly to applications via a thin protection layer, allowing LibOSes to implement their own abstractions
Explanation
Exokernels (MIT, 1995) provide minimal primitives (secure bindings, visible resource revocation, abort protocol). LibOSes implement file systems, networking, and scheduling as application libraries.
6
What is NUMA (Non-Uniform Memory Access) and its OS implications?
Correct Answer
A multi-processor architecture where memory access latency depends on which CPU accesses which memory node, requiring OS NUMA-aware scheduling and allocation
Explanation
On NUMA systems, accessing local memory is ~4ns but remote memory ~40ns. OS schedulers pin threads to CPUs near their memory (NUMA-aware allocation in Linux via libnuma).
7
What is huge pages and when are they beneficial?
Correct Answer
Pages larger than 4KB reducing TLB pressure for memory-intensive workloads
Explanation
Huge pages (2MB or 1GB on x86) cover more memory with fewer TLB entries, reducing TLB misses in workloads with large working sets (databases, JVMs). Linux Transparent Huge Pages (THP) automates this.
8
What is the completely fair queuing (CFQ) vs deadline I/O scheduler?
Correct Answer
CFQ gives equal I/O bandwidth to processes; Deadline prioritizes I/O latency with per-request deadlines, preferred for databases
Explanation
CFQ (now replaced by BFQ in Linux) fairness balancing. Deadline scheduler (mq-deadline) prevents request starvation with per-request deadlines, better for latency-sensitive workloads like databases.
9
What is control group (cgroup) in Linux?
Correct Answer
A kernel feature for hierarchically grouping processes and limiting/accounting CPU, memory, I/O, and network resources — the foundation of containers
Explanation
cgroups v2 enable resource accounting and limiting per process group. Docker and Kubernetes use cgroups + namespaces to implement container isolation without full VMs.
10
What is an eBPF program and how does it work in the Linux kernel?
Correct Answer
A sandboxed bytecode program verified by a kernel verifier and JIT-compiled to run safely inside the kernel for tracing, networking, and security
Explanation
eBPF programs pass kernel verification (no unbounded loops, no invalid memory access), are JIT-compiled to native code, and run at kernel hooks (tracepoints, kprobes, XDP). Used by Cilium, bpftrace, Falco.
11
What is the difference between type-1 and type-2 hypervisors?
Correct Answer
Type-1 runs on hardware directly; type-2 runs on a host OS
Explanation
Type-1 (bare-metal) hypervisors (VMware ESXi, Hyper-V, KVM) run directly on hardware for performance. Type-2 (hosted) hypervisors (VirtualBox, VMware Workstation) run on a host OS.
12
What is the difference between hardware virtualization (VT-x) and software emulation?
Correct Answer
VT-x (Intel)/AMD-V allows the hypervisor to run guest kernels with near-native performance using CPU extensions; software emulation translates every instruction
Explanation
Hardware virtualization (VT-x, SVM) enables VMX root/non-root modes. Privileged instructions in the guest trap to the hypervisor. Near-native performance vs 100x overhead for software emulation.
13
What is the slab allocator in the Linux kernel?
Correct Answer
A kernel memory allocator caching frequently used kernel objects (inodes, TCBs, dentry) to avoid repeated allocation/deallocation overhead
Explanation
The slab allocator (Bonwick, 1994) groups kernel objects by type into caches. Freed objects are kept warm in the cache for reuse, avoiding initialization overhead and reducing fragmentation.
14
What is Linux's OOM killer?
Correct Answer
A kernel mechanism that selects and kills processes when memory is critically exhausted to recover memory and prevent system hang
Explanation
The OOM (Out-Of-Memory) killer scores each process by memory usage, CPU time, root privilege, and nice value. It kills the highest-scoring process, freeing memory to allow the system to continue.
15
What is the difference between synchronous and asynchronous I/O?
Correct Answer
Synchronous I/O blocks the caller until completion; asynchronous I/O returns immediately and notifies the caller later via callback/event/signal
Explanation
Synchronous I/O: caller blocks until data is ready (simple but wastes CPU). Async I/O (io_uring, aio, IOCP on Windows): caller submits request and continues, getting notified on completion.
16
What is io_uring and why is it significant?
Correct Answer
A high-performance Linux async I/O interface using shared ring buffers between kernel and user space, minimizing system calls and copies
Explanation
io_uring (Linux 5.1, Jens Axboe) uses two ring buffers (submission/completion) shared between kernel and user. A single io_uring_enter() submits and reaps batches, achieving 10M+ IOPS with minimal overhead.
17
What is kernel preemption and when is it disabled?
Correct Answer
The ability of a higher-priority kernel task to preempt kernel code; disabled during interrupt handlers, spin lock regions, and critical kernel sections
Explanation
Linux 2.6+ added full kernel preemption (CONFIG_PREEMPT). Preemption is disabled in interrupt context, with spinlocks held, and in preempt_disable() sections to prevent data structure corruption.
18
What is the difference between hard and soft real-time systems?
Correct Answer
Hard real-time: missing deadlines causes system failure; soft real-time: missing deadlines degrades performance but is not catastrophic
Explanation
Hard real-time (airbags, pacemakers, flight control): deadline miss is unacceptable. Soft real-time (video streaming, trading): deadline misses are tolerable with graceful degradation.
19
What is the Rate-Monotonic Scheduling (RMS) algorithm?
Correct Answer
An optimal fixed-priority preemptive scheduling algorithm for real-time tasks where shorter-period tasks get higher priority
Explanation
RMS assigns static priorities inversely proportional to period (shorter period = higher priority). A set of n tasks is schedulable if ∑(Cᵢ/Tᵢ) ≤ n(2^(1/n) - 1) → ln(2) ≈ 69.3% as n → ∞.
20
What is the W^X (write XOR execute) memory protection policy?
Correct Answer
A policy ensuring all memory is either writable or executable but never both simultaneously
Explanation
W^X (OpenBSD), NX bit (AMD), XD bit (Intel), DEP (Windows): pages are either writable or executable, never both. This prevents code injection attacks where data is written then executed.