Print or save this cheat sheet to PDF for quick interview revision.
Operating Systems: Top 40 Fresher Interview Questions
Ranked by how many of the surveyed prep sources list each question. Curated for fast active recall.
What is thrashing in an operating system, and how does it degrade system performance?
Answer: Thrashing occurs when an operating system spends significantly more time swapping virtual memory pages than executing useful process instructions.
What are the core differences between a process and a thread?
Answer: A process is an isolated program instance with its own address space, while a thread is a lightweight execution unit sharing memory inside that process.
Under a demand paging scheme in virtual memory, when is a page brought from disk into physical RAM?
Answer: In demand paging, a page is loaded into physical memory only when a running process references an address on that page and triggers a page fault.
What is a deadlock in an operating system, and what basic situation causes it?
Answer: A deadlock is a permanent stall where each process in a set holds a resource and waits for another resource held by another process in that set.
What fundamental capability does virtual memory provide to modern computing systems?
Answer: Virtual memory creates an illusion of a large contiguous address space, allowing programs larger than physical RAM to execute reliably.
How do operating system CPU scheduling algorithms differ across preemptive and non-preemptive strategies?
Answer: CPU scheduling chooses which ready process gets the CPU next, balancing throughput, turnaround time, and latency using preemptive or non-preemptive policies.
Explain the concepts of process starvation and aging in operating system scheduling.
Answer: Starvation occurs when a runnable process is indefinitely postponed by higher-priority tasks, and aging prevents this by steadily raising its priority over time.
What is an operating system, and what are its primary resource management responsibilities?
Answer: An operating system is system software that manages hardware resources and provides a secure, abstracted platform for user applications to execute.
Which data structure does the operating system kernel use to track the state, resources, and execution context of a process?
Answer: A process is a program in active execution, represented in kernel memory by a Process Control Block containing its complete runtime context.
Describe the standard states a process transitions through during its execution lifecycle.
Answer: A process moves through New, Ready, Running, Waiting, and Terminated states as the OS allocates CPU time and manages I/O events.
According to standard operating system definitions, what is the defining characteristic of the kernel?
Answer: The kernel is the one program running at all times on the computer, executing in privileged mode to manage system resources.
What occurs during a CPU context switch, and why is context switching considered pure overhead?
Answer: A context switch saves the CPU register state of a running process and restores another, introducing pure overhead because no user code executes.
List and explain the four Coffman conditions necessary for a deadlock to occur.
Answer: Deadlock requires four simultaneous Coffman conditions: mutual exclusion, hold and wait, no preemption, and circular wait.
What is the difference between a logical address and a physical address in operating systems?
Answer: A logical address is generated by the CPU during program execution, whereas a physical address identifies an actual hardware location in physical RAM.
Compare internal fragmentation and external fragmentation in operating system memory management.
Answer: Internal fragmentation is wasted space inside an allocated memory partition, while external fragmentation is scattered free memory outside allocated blocks.
From an architectural perspective, what are the two primary purposes of a modern computer operating system?
Answer: The dual purpose of an operating system is to multiplex hardware resources efficiently and to provide clean, secure abstractions for application programs.
Which type of operating system is strictly required for environments where missing a processing deadline causes mission-critical system failure?
Answer: A hard real-time OS is needed when a missed deadline is catastrophic, because it guarantees bounded, deterministic response times.
Which resources are private to an individual thread and NOT shared with other threads in the same process?
Answer: A thread is a lightweight execution stream within a process, sharing code, data, and open files while keeping its own stack and registers.
What are the core architectural differences between paging and segmentation in memory management?
Answer: Paging splits memory into fixed-size hardware blocks eliminating external fragmentation, whereas segmentation divides memory into variable-size logical units reflecting program structure.
What is Belady's anomaly in operating systems, and which page replacement algorithm demonstrates it?
Answer: Belady's anomaly is the counter-intuitive behavior where increasing physical page frames increases total page faults under FIFO page replacement.
Which RAID configuration stripes data across multiple disks with distributed parity to provide both fault tolerance and high read throughput?
Answer: RAID combines multiple physical disk drives into a single logical storage array to provide redundancy, enhanced performance, or both.
How does a counting semaphore behave when a process invokes the wait() (or P) operation versus the signal() (or V) operation?
Answer: A semaphore is a synchronization variable accessed only through atomic wait() and signal() operations to manage concurrent access to shared resources.
What is the defining distinction between Hard Real-Time and Soft Real-Time operating systems?
Answer: In a hard real-time system, missing a deadline results in total system failure, while a soft real-time system tolerates occasional delays with reduced quality.
What is the primary role of Dijkstra's Banker's Algorithm in operating system resource management?
Answer: The Banker's algorithm is a deadlock avoidance algorithm that grants resource requests only if the resulting allocation leaves the system in a guaranteed safe state.
What does Spooling (Simultaneous Peripheral Operations On-Line) accomplish in an operating system?
Answer: Spooling buffers data for slow peripheral devices on high-speed disk storage, allowing the CPU to complete processing without blocking.
What defines a zombie process in Unix-like operating systems, and how is it properly eliminated?
Answer: A zombie process has finished executing but retains an entry in the process table until its parent reads its exit status code.
What is Inter-Process Communication (IPC), and what are the primary mechanisms operating systems provide for it?
Answer: Inter-Process Communication provides mechanisms like shared memory, message queues, pipes, and sockets for isolated processes to exchange data and coordinate execution.
Contrast the architectural designs of a monolithic kernel and a microkernel.
Answer: Monolithic kernels run all OS services in privileged kernel space for raw speed, while microkernels move most services to user space for modularity and fault isolation.
Explain the fundamental differences between a program and a process in computer systems.
Answer: A program is a passive executable file stored on disk, whereas a process is an active program instance currently executing in memory with dedicated resources.
What fundamental rule dictates the difference between preemptive and non-preemptive CPU scheduling?
Answer: In preemptive scheduling the OS can forcibly reclaim the CPU from a running process, whereas in non-preemptive scheduling the process controls the CPU until it yields.
In Round Robin (RR) CPU scheduling, what is the impact of choosing an excessively large versus an excessively small time quantum?
Answer: Round Robin assigns each ready process a fixed time slice in circular order, balancing fairness against context switching overhead.
What are the four primary benefits of multithreaded programming in modern software systems?
Answer: Multithreading improves application responsiveness, enables lightweight resource sharing, lowers context switching overhead, and scales across multiple CPU cores.
What fundamental memory management problem does paging solve, and how does it accomplish this?
Answer: Paging eliminates external fragmentation by allowing physical memory to be allocated to processes non-contiguously in fixed-size frames.
Under what specific condition does external fragmentation occur in primary memory?
Answer: External memory fragmentation occurs when total free memory is sufficient to satisfy a request, but the memory is split into non-contiguous blocks.
Which page replacement algorithm is provably optimal by replacing the page that will not be used for the longest period of time, serving as a theoretical benchmark?
Answer: Optimal page replacement evicts the page unreferenced for the longest future time, while LRU uses past references to approximate this ideal.
What is a system call in an operating system, and how does user software invoke one?
Answer: A system call provides the essential programmatic interface allowing user-space programs to safely request privileged services from the operating system kernel.
In network operating systems and inter-process communication, what two core elements define a network socket endpoint?
Answer: A socket is an endpoint for bidirectional network communication uniquely identified by the combination of an IP address and a port number.
What is a primary functional distinction between a mutex and a binary semaphore?
Answer: A mutex is a locking mechanism owned solely by the thread that locked it, whereas a semaphore is a signaling mechanism without ownership.
What constitutes a critical section in concurrent programming, and what fundamental requirement must a solution satisfy?
Answer: A critical section is a code block accessing shared mutable data that must execute with mutual exclusion to prevent race conditions.
Why do modern processors and operating systems implement dual-mode operation with user mode and kernel mode?
Answer: Dual-mode operation protects the system by restricting privileged CPU instructions and direct hardware access exclusively to kernel mode.