Operating system interviews should reveal whether a candidate can explain why an application waits, consumes memory or fails to preserve a write. Definitions alone do not show whether someone can trace resource ownership, distinguish virtual memory from physical residency or choose the next useful observation in an incident. Recruiters should look for explanations that connect a mechanism to an application’s behavior.
This guide to 100+ Operating System Interview Questions and Answers contains 120 questions across beginner, intermediate and experienced levels. It covers processes, scheduling, virtual memory, synchronization, file systems, I/O and practical diagnosis. General teaching models are distinguished from explicitly identified Linux or POSIX behavior, whose details depend on the target version and configuration.
How can recruiters distinguish operating system understanding from memorized definitions during a remote interview?
Ask a candidate to trace two threads competing for a resource, explain a page fault or identify what a successful write actually guarantees. Then change one condition, such as a full queue, a process crash or a memory limit. A strong response explains which invariant changed and what evidence would confirm the proposed cause before suggesting a fix.
Sherlock AI helps hiring teams assess signals of potential AI cheating, deepfakes, impersonation and unauthorized assistance during remote interviews. Combine those signals with small traces, debugging scenarios and consistent follow-up questions. They provide context for human review rather than conclusive proof of misconduct.
Operating System Interview Questions
Begin with process and memory fundamentals, then choose concurrency or operational scenarios relevant to the role. Each question has a matching numbered answer below. Ask candidates to state the platform assumptions behind their explanation.
Operating System Interview Questions for Beginners
Establish process, scheduling, memory and synchronization fundamentals.
What is an operating system?
What is the kernel?
How do user mode and kernel mode differ?
What is a system call?
What is a process?
How does a program differ from a process?
What is a thread?
How do processes and threads differ?
What states can a process occupy?
What is a process control block?
What is context switching?
What is CPU scheduling?
How does preemptive scheduling differ from cooperative scheduling?
What is round-robin scheduling?
What is turnaround time?
What is response time?
What is throughput?
What is starvation?
What is virtual memory?
What is paging?
What is a page table?
What is a TLB?
What is a page fault?
What is demand paging?
What is swapping?
What is thrashing?
How do internal and external fragmentation differ?
What is the difference between stack and heap memory?
What is a file descriptor?
What is a file system?
What is an inode?
How do a hard link and a symbolic link differ?
What is an interrupt?
What is a device driver?
How do blocking and nonblocking I/O differ?
What is a race condition?
What is a critical section?
What is a mutex?
What is a semaphore?
What is deadlock?
Operating System Interview Questions for Intermediate
Probe concurrency protocols, system-call semantics and persistent storage.
What are the Coffman conditions for resource deadlock?
How can lock ordering prevent deadlock?
How does deadlock avoidance differ from prevention?
What does the Banker's algorithm determine?
How does livelock differ from deadlock?
What is priority inversion?
What is a condition variable?
Why must a condition-variable predicate be checked under a lock?
When is a spinlock appropriate?
How does an atomic operation differ from a mutex?
What is memory ordering?
Why is volatile not a general synchronization mechanism?
What is copy-on-write?
What does fork do on POSIX-like systems?
What does exec do?
What is a zombie process?
What is an orphan process?
Why is fork in a multithreaded process tricky?
How can file descriptors leak across exec?
How do pipes support interprocess communication?
How does shared-memory IPC differ from message passing?
What should code do after a partial write?
What does readiness notification guarantee?
How do level-triggered and edge-triggered epoll differ?
What is a signal?
Why must signal handlers use restricted operations?
What is the difference between SIGTERM and SIGKILL?
What is memory mapping?
How do MAP_PRIVATE and MAP_SHARED differ?
What is a working set?
What is locality of reference?
How do FIFO and LRU page replacement differ?
What is Belady's anomaly?
How do minor and major page faults differ on Linux?
What does the page cache do?
Does a successful write mean data is durable?
What does fsync guarantee on Linux?
What is journaling in a file system?
What is the difference between a file offset and a descriptor?
How does unlink affect an open file?
Operating System Interview Questions for Experienced
Assess diagnosis, scalability, isolation and failure recovery.
How would you investigate high CPU usage?
How would you investigate high load with low CPU utilization?
How would you diagnose a memory leak?
How would you investigate an out-of-memory termination?
What is memory overcommit?
How do cgroups and namespaces differ?
How do containers differ from virtual machines?
What is a capability in Linux?
How would you apply least privilege to a service?
What is a time-of-check to time-of-use race?
How can a symbolic-link race affect file operations?
How do NUMA systems affect performance?
What is false sharing?
Why can more threads reduce throughput?
What is the difference between concurrency and parallelism?
How would you choose between a thread pool and an event loop?
How would you detect a deadlock in a running service?
How would you reduce lock contention?
What do lock-free and wait-free mean?
What is the ABA problem?
Why is memory reclamation difficult in concurrent structures?
What does a read-copy-update approach achieve?
What makes real-time scheduling different?
How do hard and soft real-time requirements differ?
Why is a scheduler description version-dependent?
How do CPU affinity and scheduling priority differ?
How can huge pages help or hurt?
How would you design a crash-safe file replacement?
How does atomicity differ from durability?
How would you handle disk-full errors safely?
How would you investigate a file-descriptor leak?
What is backpressure in an operating-system context?
How do wall-clock and monotonic time differ?
How would you test a concurrent component?
How would you benchmark a system-call-heavy workload?
How do security mitigations affect performance analysis?
How would you recover from a kernel panic?
How would you explain platform-specific assumptions in an interview?
What should an operating-system incident report include?
What demonstrates senior operating-system judgment?
Operating System Interview Questions and Answers
These answers reward explicit assumptions, correct invariants and evidence-based diagnosis. Use the examples to test reasoning, then ask how the conclusion would change on a different operating system, workload or configuration. A teaching simulation illustrates a mechanism without establishing real-system timing or behavior.
Operating System Interview Questions and Answers for Beginners
Look for clear distinctions between execution, scheduling, address spaces and synchronization. A useful response traces a small example and explains which resource or guarantee is involved.
1. What is an operating system?
An operating system manages hardware resources and provides abstractions such as processes, virtual memory and files. It coordinates access and enforces protection so applications can run without directly controlling every device.
When a text editor saves a document, it uses file operations rather than directly programming a storage controller. The operating system coordinates that request with other applications, manages memory and checks access permissions. These abstractions let applications share hardware without each implementing the whole machine. Resource management does not imply unlimited capacity: a process can still run out of memory, wait for I/O or be denied access under the system's policies.
2. What is the kernel?
The kernel is the privileged core responsible for mechanisms such as scheduling, memory management and device access. Utilities and graphical interfaces may be part of an operating-system distribution without running inside the kernel.
For example, a shell parses a command in user space and asks the kernel to create or execute work; the shell itself is not the kernel. In a monolithic design, many services run in the privileged core, whereas other designs move more services outside it. The distinction affects fault containment and communication costs, so “part of the operating system” and “executes with kernel privilege” should not be treated as equivalent statements.
3. How do user mode and kernel mode differ?
Processor privilege levels restrict which operations ordinary application code may perform. A controlled system-call or exception path enters privileged code; this transition does not necessarily switch to a different process.
An application can calculate a sum in user mode, but it must use an authorized interface to request protected device access. During a system call, kernel code can execute on behalf of that same thread and later return to it. That is a mode transition, not necessarily a context switch to another task. Conversely, a scheduling event may select different work; the two concepts describe different changes in execution.
4. What is a system call?
A system call requests a kernel service through a defined interface, such as opening a file or creating a process. A library function may wrap a system call, perform several calls or complete entirely in user space.
On Linux, read() requests bytes through a file descriptor, while a C library operation such as buffered input can serve bytes already in a user-space buffer without a new kernel request each time. One source-level call therefore does not always correspond to one system call. When analyzing overhead, identify the actual boundary crossings and data copies rather than count library calls or assume every utility function enters privileged code.
5. What is a process?
A process is an execution environment with an address space and operating-system resources. It can contain multiple threads, and its identity is distinct from the executable file from which it started.
Two editor processes can execute the same binary while holding different documents, file descriptors and virtual-memory contents. Their virtual addresses may have equal numeric values without referring to the same physical pages. A process provides an important isolation boundary, but it can deliberately share memory or other resources through defined mechanisms. Its threads perform execution, while the process describes much of the environment and ownership around that work.
6. How does a program differ from a process?
A program is code and associated static data, while a process is a running instance with execution state and resources. Several processes can execute the same program independently.
A compiler executable stored on disk is a program; launching it for two source files can create two processes with separate arguments, working state and lifetimes. Closing one need not stop the other. A process can also replace its executable image through a platform facility such as POSIX exec while retaining its process identity. That illustrates why a process is not simply the executable file loaded into RAM.
7. What is a thread?
A thread is an execution stream with its own instruction state and stack within a process. Threads generally share the process address space and resources, which enables communication but creates synchronization obligations.
A server might use several threads to handle requests while sharing a cache. Each thread needs its own call stack and register state, but a write to the shared cache can be observed by others under the applicable synchronization rules. A thread's private stack does not make every object it references private. It also does not guarantee parallel execution: runnable threads may take turns on one CPU or run simultaneously on several.
8. How do processes and threads differ?
Separate processes normally have separate virtual address spaces, whereas threads in one process share memory. Isolation, communication cost and failure containment differ; exact creation and switching costs depend on the platform and workload.
Processes can isolate faults and communicate through messages or explicitly shared memory; threads can communicate directly through shared objects but need disciplined synchronization. A worker thread corrupting shared memory can damage the entire process. Choosing threads only because they are “lighter” overlooks the workload's fault and ownership requirements. Costs depend on the system, so a defensible comparison describes the communication pattern and measures the relevant operations rather than promising a universal speed ratio.
9. What states can a process occupy?
A simplified model includes ready, running and blocked, with creation and termination states as needed. Ready means eligible for CPU service; blocked means waiting for an event such as I/O or synchronization.
A task waiting for a disk result is blocked and cannot use the CPU to finish that request. When the result arrives, it becomes ready, but may still wait behind other eligible tasks before running. This distinction matters during diagnosis: a slow application may be waiting for I/O rather than suffering CPU starvation. Real systems expose more detailed state names, and multithreaded processes can contain threads in different states at once.
10. What is a process control block?
It is a conceptual kernel data structure holding information needed to manage a process, such as identifiers, execution state and resource references. Real kernels may distribute this information across several structures rather than one textbook object.
To resume interrupted work, the operating system needs execution context and scheduling information, together with references to resources such as memory mappings and open files. A textbook PCB collects these ideas in one box. Linux, for example, uses task and associated resource structures rather than requiring one literal object with every field. Explain the purpose of the recorded state before memorizing a platform-specific structure layout that may change.
11. What is context switching?
A context switch saves one execution context and restores another so a CPU can run different work. Its cost includes direct bookkeeping and possible cache or translation effects, not merely saving registers.
If a timer leads the scheduler to replace task A with task B, A's resumable state must be saved and B's restored. B may then encounter cold caches or translations that add indirect cost beyond the scheduler's own instructions. Switching between threads sharing an address space can differ from switching between unrelated processes, but neither has one fixed cost. A system call returning directly to the same thread need not involve this task change.
12. What is CPU scheduling?
Scheduling selects eligible work to run on available processors according to policy. Goals can include responsiveness, throughput, fairness or deadlines, and these goals may conflict.
An interactive editor benefits from prompt CPU access after a keystroke, while a batch computation may benefit from long uninterrupted runs. A scheduling policy balances those needs with fairness and any priority or deadline rules. It chooses among eligible tasks; it cannot make a blocked disk request ready merely by changing priority. Modern multiprocessor scheduling must also consider placement and affinity, so a single ready-queue diagram is a simplified teaching model.
13. How does preemptive scheduling differ from cooperative scheduling?
Preemptive scheduling can interrupt running work to schedule another task, while cooperative scheduling relies on tasks yielding or blocking. Cooperative designs simplify some control paths but can lose responsiveness when a task does not yield.
In a cooperative event loop, a callback doing a long computation without yielding can delay every other callback on that loop. A preemptive operating-system scheduler can interrupt a running thread to schedule another eligible thread, subject to its policy and constraints. Preemption improves control over responsiveness but creates more possible interleavings. It does not remove the need for application-level cooperation when one event-loop thread monopolizes its own logical tasks.
14. What is round-robin scheduling?
Round robin rotates runnable tasks through bounded time quanta. A short quantum can improve responsiveness while increasing switching overhead; a long quantum approaches first-come service for short workloads.
In a simple one-CPU model with tasks A needing three time units and B needing one, both arriving together, a quantum of one produces A, B, A, A if A runs first. B completes at time two instead of waiting for A's entire burst. This ignores switching cost and I/O deliberately. Real scheduling policies are more complex, but the trace makes the responsiveness-versus-overhead trade-off concrete.
15. What is turnaround time?
Turnaround time is the elapsed interval from a job's arrival or submission to completion under a stated model. It includes waiting, execution and any relevant blocked time, so it differs from CPU service time.
In the fixture, the job arrives at time 2 and finishes at 12, so turnaround is 10 even though it uses only 7 units of CPU. Under the explicitly stated single-burst, no-blocking model, the remaining 3 units are waiting time. If the job also spent time blocked for I/O, subtracting CPU service alone would combine waiting and blocked time, so the same shortcut would no longer isolate ready-queue waiting.
Python teaching model
16. What is response time?
Response time measures how long a request waits for its first relevant response or service event, with the definition stated explicitly. Interactive systems often care about it even when total completion time is unchanged.
A command can display its first progress message quickly yet finish much later; its initial response and total turnaround measure different aspects of the experience. In a scheduling exercise, response often means first CPU start minus arrival. In a network service, it may mean the first byte or a completed response, so state the convention. Comparing measurements with different start and end events produces misleading conclusions even when every timestamp is accurate.
17. What is throughput?
Throughput is the amount of completed useful work per unit time. Higher throughput does not necessarily imply lower latency, particularly when batching or queueing increases waiting time.
A server completing 1,000 requests per second has higher throughput than one completing 500 under comparable work, but individual requests may wait longer in a larger batch. Count completed useful operations, not merely accepted requests accumulating in a queue. Also specify workload and interval: a brief burst that drains cached work is different from sustained throughput under normal storage and network constraints. Latency and error rate belong beside the throughput number.
18. What is starvation?
Starvation occurs when an eligible task is repeatedly denied the resources it needs while other work progresses. Fair queueing or aging may mitigate it, but the guarantee depends on the policy and resource involved.
A low-priority job can remain ready indefinitely if higher-priority work continually arrives and the scheduler provides no effective fairness mechanism. The machine is busy, so this differs from a deadlock in which the dependent participants cannot progress. Aging raises waiting tasks' effective priority in some policies, but a claim of bounded waiting needs the policy's actual guarantee. Similar starvation can occur at a lock even when CPU scheduling is fair.
19. What is virtual memory?
Virtual memory gives processes address spaces whose mappings and protections are managed separately from physical RAM. It supports isolation and flexible allocation; it is not simply another name for disk-backed swap.
A process can have a large reserved address range with only some pages backed by physical RAM. Another process can use an overlapping virtual address range with different mappings. Those mappings provide both convenience and protection; they are not a promise that every allocated byte is immediately resident. Swap is one possible backing mechanism, while file-backed pages, shared mappings and demand-zero allocation are other parts of the broader virtual-memory model.
20. What is paging?
Paging divides virtual memory and physical storage into fixed-size units that can be mapped through page tables. It avoids requiring each process to occupy one contiguous physical region, while introducing translation and metadata costs.
Under an assumed 4,096-byte page size, virtual address 8,205 lies in virtual page 2 at offset 13. Mapping that virtual page to physical frame 7 produces physical address 28,685 in the teaching model. The offset stays the same while the page number is translated. The example does not assert a universal page size or model permissions, huge pages or translation caches; it isolates the arithmetic behind paging.
Python teaching model
21. What is a page table?
A page table records mappings and attributes for virtual pages, including permissions and presence information. Multilevel designs avoid allocating a flat entry for every possible virtual address in sparse address spaces.
A process using a few small regions of a very large virtual address space would waste substantial metadata with one fully populated flat mapping array. Hierarchical page tables allocate lower-level structures where mappings are needed. An entry also participates in access control, not just address lookup. Linux presents a multilevel software hierarchy whose levels can be folded for architectures that need fewer hardware levels, so the number of actual translation steps is architecture-dependent.
22. What is a TLB?
A translation lookaside buffer caches recent address translations and permissions to reduce page-table lookup cost. A TLB miss is not automatically a page fault: the translation may exist in the page tables.
If a translation is absent from the TLB but a valid present mapping exists in the page tables, the system can obtain that mapping and continue without loading a page from disk. A page fault instead means the access cannot proceed under the current mapping or permissions. Large working sets can pressure the TLB even when all data is resident. This is why translation-cache misses and storage-related faults should not be counted as the same event.
23. What is a page fault?
A page fault is an exception caused when a memory access cannot proceed under the current translation or protection state. It may be resolved by allocating or loading a page, or rejected as an invalid access; not every fault requires disk I/O.
The first write to a copy-on-write page can fault so the kernel creates a private copy and updates the mapping; the application then continues. Accessing an unmapped or forbidden address may instead produce a fatal error, such as a Linux SIGSEGV under the applicable conditions. A disk read is only one possible resolution path. When diagnosing fault counts, distinguish expected allocation faults from storage waits and invalid accesses.
24. What is demand paging?
Demand paging establishes or loads pages when an access requires them rather than eagerly making every page resident. It reduces unnecessary work but can introduce latency on first access.
A program may reserve a large buffer but initially touch only a small portion. Demand allocation lets the system defer backing untouched pages until needed, saving immediate work and memory. A later pass that touches every page can then incur first-access costs that were absent from startup measurements. Prefaulting can trade earlier work for more predictable later access, but it does not create unlimited physical capacity or eliminate every source of latency.
25. What is swapping?
Swapping moves memory contents to backing storage so physical memory can be reused, though terminology differs across systems. Modern discussions often mean paging out selected pages rather than moving an entire process at once.
If anonymous pages are not actively used, a system may write them to swap backing and reuse the physical frames. Accessing them later can require bringing them back, adding latency. Clean file-backed pages can often be discarded and reread from their files instead, which is a different reclaim path. Terminology and policies vary, so specify whether “swapping” means whole-process movement in a textbook model or page-level activity on the system being discussed.
26. What is thrashing?
Thrashing occurs when excessive page movement consumes resources and prevents useful progress because active working sets do not fit effectively. Adding CPU capacity alone does not resolve a memory-working-set problem.
Suppose several active workloads repeatedly touch more pages than available memory can retain. Evicting one workload's page to serve another causes the first to fault again soon afterward, producing heavy paging with little useful progress. Reducing concurrent working sets or increasing appropriate memory capacity can help; a faster CPU alone does not address the cause. Confirm memory pressure and fault/I/O behavior before calling every slow, disk-busy system thrashing.
27. How do internal and external fragmentation differ?
Internal fragmentation is wasted space inside an allocated unit, while external fragmentation is free space split into unsuitable gaps. Paging reduces certain external allocation problems but can waste space within pages and does not eliminate every physical allocation constraint.
With 4 KiB allocation units, a 1 KiB object can leave 3 KiB unused inside its assigned unit: internal fragmentation. In a variable-sized allocator, free gaps of 2 KiB each may not satisfy one contiguous 3 KiB request even though total free space exceeds it: external fragmentation. Paging lets ordinary virtual pages map to separated frames, but larger contiguous allocations and allocator arenas still introduce their own constraints.
28. What is the difference between stack and heap memory?
Stacks support call frames and automatic storage in common implementations, while heaps support dynamically managed allocation. Both reside in virtual memory, and their layout, growth limits and lifetime rules depend on the language and runtime.
A function's local bookkeeping commonly lives in stack frames that are reclaimed as calls return, while a dynamically allocated object can outlive the function that created it. Exact placement is a language/runtime decision; an optimizing compiler may keep a local in a register or move allocation behavior. Thread stacks have limits, and deep recursion can exhaust them. Heap allocation also needs lifetime management through mechanisms such as explicit deallocation, ownership or garbage collection.
29. What is a file descriptor?
On POSIX-like systems a file descriptor is a small integer handle in a process's descriptor table. It refers to an underlying open file description or another supported resource, and the integer may be reused after closure.
Opening a file can return descriptor 3, which the process uses in later read or write requests. Closing it makes that number available for reuse, so retaining 3 as a permanent identity is unsafe. On Linux and POSIX-like interfaces, duplicated descriptors can refer to the same open file description and share its offset. A pathname and a descriptor therefore serve different roles: one locates an object, while the other references an already opened resource.
30. What is a file system?
A file system organizes data and metadata using abstractions such as files, directories and permissions. Some file systems are memory-backed; persistence is not universal. Its guarantees for ordering, durability and concurrent access depend on the implementation and configuration.
A directory entry lets an application locate a file, while allocation metadata identifies its stored contents. Writing successfully through an application buffer does not automatically establish that data will survive a power loss; buffering, synchronization calls and filesystem/device guarantees matter. A journal can help recover filesystem structure without guaranteeing every recent application write. File naming, access control and durability are related services, but they should not be collapsed into one vague “saved” state.
31. What is an inode?
In Unix-style file systems an inode represents file metadata and references to data storage. A filename is normally held in a directory entry that refers to the inode, so several names can reference one file.
Two hard-linked names can point to one inode, so modifying the file through either name affects the same underlying contents. Removing one name does not necessarily remove the file while other links or open references remain. An inode number is meaningful within a filesystem and may be reused after deletion, so it is not an eternal global identifier. A file's name is stored in directory information rather than being its single intrinsic identity.
32. How do a hard link and a symbolic link differ?
A hard link is another directory entry for the same underlying file, while a symbolic link stores a path to resolve. Symbolic links can cross file-system boundaries and become dangling; hard links have file-system and object-type restrictions.
If report-current is a symbolic link to report-v1, removing the target can leave a dangling link because resolution still follows that path. A hard link to the same file instead provides another name for the underlying object, so removing the original name does not by itself break it. Hard links normally stay within one filesystem and directory linking is restricted; symbolic-link traversal also needs security-aware handling in privileged paths.
33. What is an interrupt?
An interrupt redirects processor execution to handle an event such as a device notification or timer. The handler and deferred work must cooperate with normal execution while respecting latency and synchronization constraints.
A timer interrupt can give the kernel an opportunity to account for time or consider scheduling, while a network device interrupt can indicate completed work. Not every interrupt causes a process switch. Handlers often defer substantial processing so time-sensitive execution is not blocked unnecessarily, but the exact split depends on the operating system and driver. Keep interrupts distinct from synchronous exceptions caused by the currently executing instruction, such as a page fault.
34. What is a device driver?
A driver implements the operating system's interaction with a device or device class. Drivers translate abstract requests into device operations and handle completion, errors and resource management.
An application can request a network send through a common interface while a driver handles the specific device's queues, descriptors and completion events. It must cope with errors and resource cleanup, not merely translate a command once. Depending on the OS design, some driver code may run in user space rather than the kernel. Hardware access and concurrency make incorrect driver behavior especially consequential when privileged resources are involved.
35. How do blocking and nonblocking I/O differ?
A blocking operation may wait until it can make progress, while a nonblocking operation returns promptly when it cannot proceed. Nonblocking does not mean the operation is complete; callers must handle partial work and retry conditions.
On a nonblocking socket, a read with no available data can return an EAGAIN/EWOULDBLOCK-style result rather than wait. A successful read can still return fewer bytes than requested, so callers need to track partial progress and readiness. Nonblocking is not synonymous with asynchronous completion, and regular-file behavior may differ from sockets. A busy loop repeatedly retrying without waiting for a meaningful event can waste CPU while achieving little useful work.
36. What is a race condition?
A race condition occurs when correctness depends on an uncontrolled ordering of concurrent events. A language-level data race is a narrower concept involving unsynchronized conflicting memory accesses; not every logical race is a data race.
The synthetic trace has two workers read a counter value of zero, each compute one, and then both write one. Two intended increments produce only one net increase because the read-modify-write operation was not coordinated. This example is an explicit sequential simulation of a bad interleaving, not a claim about Python interpreter atomicity. Logical races can also span separate services, such as checking availability and reserving the last item without an atomic protocol.
Python teaching model
37. What is a critical section?
A critical section accesses shared state whose invariant requires coordinated access. Its protection must cover the entire read-modify-write relationship rather than only individual assignments.
For a bounded queue, checking that space exists and then inserting an item must preserve the capacity invariant together. Protecting only the assignment leaves a gap in which another producer can also observe the free slot. The critical section should include the necessary state relationship but avoid unrelated slow work, such as a network call, where practical. All participants must use a compatible synchronization protocol, including readers whose assumptions depend on that state.
38. What is a mutex?
A mutex provides mutually exclusive ownership of a protected region or resource. Correct use also requires a consistent locking protocol; simply adding a lock object does not protect code paths that ignore it.
If two threads update a shared balance, they should acquire the same protecting mutex around the complete invariant-preserving update and release it reliably on every exit path. Using a different mutex per thread provides no mutual exclusion over that shared value. Ownership rules and error behavior depend on the mutex type and API. A mutex also does not automatically guarantee fairness, prevent deadlock across several locks or repair an invalid operation performed while holding it.
39. What is a semaphore?
A semaphore maintains a count used to coordinate access to a bounded resource or signal availability. Unlike a mutex, it need not encode ownership in the same way, so substituting one for the other can change correctness properties.
A semaphore initialized to three can limit work to three concurrent users of a bounded resource, with an acquire before use and a matching release afterward. A binary semaphore has two count states but is not automatically interchangeable with an owner-tracking mutex. Releasing without an acquired permit can corrupt the accounting, and releasing on failure must follow the chosen API's rules. Semaphore synchronization controls admission; it does not itself protect every invariant inside the resource.
40. What is deadlock?
Deadlock is a state in which participants cannot progress because each waits for an event or resource that depends on another participant in the set. Diagnose the actual dependency cycle rather than assuming every long wait is a deadlock.
Thread A holds lock X and waits for Y, while thread B holds Y and waits for X: neither can release the lock the other needs through its normal path. A consistent global lock order can prevent that particular cycle. A slow I/O operation is not automatically deadlock, so inspect ownership and wait dependencies. Timeouts can help recover from some waits, but retrying without changing the acquisition pattern may merely recreate the same cycle.
Operating System Interview Questions and Answers for Intermediate
These answers connect concurrency protocols and system interfaces to observable behavior. Strong candidates explain ownership, error handling and the limits of a successful operation rather than merely naming an API.
41. What are the Coffman conditions for resource deadlock?
The classical resource-deadlock model requires mutual exclusion, hold-and-wait, no preemption and circular wait. Together they describe tasks holding exclusive resources while waiting in a cycle for resources that cannot simply be taken away.
For example, thread A holds lock X and waits for Y while thread B holds Y and waits for X. The locks are exclusive, each thread holds one while requesting another, neither lock is forcibly reclaimed, and their waits form a cycle.
Preventing one condition can prevent this class of deadlock, but the remedy must fit the resource. Making data shareable or acquiring resources together may be possible; forcibly taking a mutex from a thread modifying an invariant generally is not. Identify the actual resources and protocol rather than reciting the conditions without applying them.
42. How can lock ordering prevent deadlock?
Assign locks a consistent order and require every path that holds several locks to acquire them in that order. A cycle would require some participant to move backward in the order, so excluding that acquisition pattern prevents circular wait among those locks.
If account locks are ordered by stable account ID, both transfers from A to B and from B to A acquire the smaller-ID lock first. Ordering by transfer direction would instead create the opposite acquisition paths that permit deadlock.
Include cleanup, callbacks and indirect helper calls in the rule. A callback invoked while holding a lock may acquire another lock unexpectedly. Document ownership and avoid calling unknown code under locks where possible. The ordering must also handle equal identities or repeated acquisition deliberately rather than accidentally self-deadlocking.
43. How does deadlock avoidance differ from prevention?
Deadlock prevention imposes rules that eliminate a necessary condition, such as a global lock order. Avoidance instead evaluates a proposed allocation and grants it only if the system remains safe under a model of future resource needs.
A prevention policy may require a task to request all needed devices at once, reducing hold-and-wait but potentially wasting resources. An avoidance policy can allow more flexible allocation when it knows each task's maximum demand and can demonstrate a completion sequence.
That information requirement is a major limitation. General application threads often do not know their future lock or resource demands precisely. Avoidance is therefore not simply a smarter scheduler that detects every future problem; its guarantees depend on accurate declared demands and the assumptions of its allocation model.
44. What does the Banker's algorithm determine?
The Banker's algorithm tests whether available resources and remaining declared demands admit an order in which every process can finish. It tentatively assumes an eligible process completes and releases its allocation, then repeats that check for the remaining processes.
Suppose one resource type has three free units. A process holding two and needing one more can finish first, releasing its resources; that may then let a second process obtain what it needs. Finding such an order establishes safety under the declared maxima.
An unsafe state is not necessarily already deadlocked: tasks might request less than their maxima or finish through another actual path. The algorithm is conservative about possible demand. Incorrect maxima, resources outside the model or tasks that do not release resources as assumed invalidate the conclusion.
45. How does livelock differ from deadlock?
In a deadlock, participants are stuck waiting for one another. In a livelock, they continue responding or retrying but make no useful progress. Activity and CPU use therefore do not prove that a concurrent system is advancing.
Two workers might repeatedly notice a conflict, release their resources and retry at exactly the same time. Their politeness prevents either from completing. Simply waking them again does not solve the coordination pattern.
Use a protocol that breaks symmetry, such as an ordering rule, bounded randomized backoff or a designated winner where appropriate. Also bound retries and observe completed work rather than only attempts. Backoff reduces some collisions but should not become an indefinite loop that hides a persistent incompatibility or overload condition.
46. What is priority inversion?
Priority inversion occurs when high-priority work waits for a resource held by a lower-priority task, while medium-priority work prevents that holder from running and releasing it. The high-priority task is indirectly delayed by work that should not otherwise outrank it.
For example, a low-priority thread holds a mutex needed by a real-time thread. Several medium-priority CPU tasks then keep preempting the holder. Priority inheritance can temporarily raise the holder's scheduling priority so it can complete the critical section.
The guarantee depends on the scheduler and mutex protocol, including nested dependencies. It does not fix long blocking I/O inside the critical section or poor resource design. Keep critical sections bounded and verify the platform's supported priority mechanisms instead of assuming every ordinary mutex implements inheritance.
47. What is a condition variable?
A condition variable lets a thread wait for a predicate about shared state while releasing the associated mutex. The wait operation coordinates releasing the mutex and waiting, and the thread reacquires the mutex before proceeding after wakeup.
For a queue, the predicate might be ‘the queue is nonempty or shutdown was requested.’ A consumer waits in a loop while that predicate is false, then checks which condition applies before removing an item or exiting.
A notification is not an item reservation. Another consumer may take the item first, and spurious wakeups are permitted by common condition-variable contracts. Recheck the predicate under the mutex rather than replacing the loop with IF. The shared state determines correctness; the notification only prompts another examination.
48. Why must a condition-variable predicate be checked under a lock?
The mutex must protect both the predicate and the protocol that transitions from checking it to waiting. Otherwise a producer can change the state and notify after the consumer's check but before it actually waits, leaving the consumer asleep despite work being available.
In a queue example, the consumer holds the queue mutex while checking emptiness, then uses the condition wait that releases it as part of the waiting protocol. The producer changes the queue under the corresponding synchronization discipline and signals according to that protocol.
Checking the predicate outside the lock and adding a sleep does not repair the race. Keep all accesses to the protected state consistent, including shutdown flags. The exact placement of notification can depend on the API and design, but the check/change/wait relationship must not contain an unprotected lost-wakeup gap.
49. When is a spinlock appropriate?
A spinlock repeatedly checks for availability instead of putting the waiter to sleep. It can suit a very short critical section when sleeping is unavailable or would cost more than the expected wait and the holder can run promptly.
If the holder is preempted while many other threads spin on an oversubscribed machine, the waiters can waste CPU that would help the holder finish. A long operation or blocking I/O inside the protected region is therefore a poor fit.
Kernel and user-space contexts have different restrictions, so state the environment. Some mutex implementations already use adaptive spinning before sleeping. Choose from measured contention, scheduling and critical-section duration, not the assumption that avoiding a context switch always makes spinning faster.
50. How does an atomic operation differ from a mutex?
An atomic operation provides the language or platform's specified indivisibility and memory-order behavior for that operation. A mutex can protect a larger invariant spanning several reads and writes. Making each field atomic does not make an arbitrary combination of fields update atomically.
For example, independently atomic balance and reserved_amount fields can still be observed in a combination that violates the account invariant if the update protocol is wrong. A lock can make the whole transition exclusive; a lock-free design needs a carefully proved alternative protocol.
Atomics are valuable for appropriate counters and coordination, but read-modify-write and ordering requirements must be explicit. Compare-and-swap loops also need progress and lifetime reasoning. Replacing a mutex with atomics is an algorithm change, not merely a faster implementation of identical semantics.
51. What is memory ordering?
Memory ordering specifies which observations of reads and writes are permitted across threads and processors. Compiler transformations, CPU behavior and language rules mean source-code order alone does not establish safe communication between threads.
In a producer-consumer pattern, publishing a ready flag must also establish that the consumer can observe the initialized data. A suitable release/acquire protocol or mutex can provide that relationship when used correctly. An atomic flag with inappropriate ordering does not automatically publish every surrounding access.
Start from the language's memory model and the invariant, then select synchronization. C and C++ data races have particularly serious consequences, while other languages define different behavior. Do not infer a portable guarantee from a test that repeatedly succeeds on one processor architecture.
52. Why is volatile not a general synchronization mechanism?
Volatile has language-specific meaning and must not be treated as a universal concurrency primitive. In C and C++, volatile access alone does not supply the atomicity and inter-thread ordering needed to make ordinary shared-state communication correct.
For example, marking a shared C counter volatile does not make increment an indivisible read-modify-write operation. Two threads can still lose updates, and unrelated data publication still needs a valid synchronization protocol.
Java volatile has stronger memory-model semantics, including visibility and ordering relationships, but even there counter++ is a compound operation rather than an atomic increment. Identify the language before answering. Use documented atomics, locks or other synchronization designed for the invariant rather than relying on the slogan that volatile forces immediate visibility.
53. What is copy-on-write?
Copy-on-write lets multiple mappings initially refer to the same physical data while preserving private-write semantics. A write to a privately shared page can trigger a fault and create a private copy, avoiding the cost of eagerly copying every page.
After fork on a typical Linux implementation, parent and child can initially share private pages this way. If the child immediately executes another program, much of the original address space may never need copying. If both processes write extensively, copying and memory costs appear later.
The unit is commonly a page, so changing a small object can copy more than that object's bytes. Shared mappings have a different contract and may intentionally expose writes to other mappings. Copy-on-write is therefore a deferred-cost strategy, not a guarantee that duplication consumes no additional memory.
54. What does fork do on POSIX-like systems?
Fork creates a child process with a distinct process ID and an initially similar execution environment. Parent and child continue from the call with different return values, and their private-memory modifications are isolated.
Inherited file descriptors can nevertheless refer to the same open file description, so operations can share a file offset. A child's read can therefore affect where the parent's next read starts. Process isolation does not imply that every inherited kernel resource is independent.
Check failure and distinguish parent from child explicitly. State the POSIX-like or Linux context, since process creation differs across operating systems. Shared mappings and other inherited resources need their own ownership protocol.
55. What does exec do?
An exec-family operation replaces the current process's program image with another executable. It keeps the process identity rather than creating a second process, and a successful exec does not return to the old program. Returning from the call indicates failure.
A shell commonly creates a child and then has that child exec the requested command. That separates process creation from program replacement. If exec fails, the child must report the error and exit appropriately rather than accidentally continuing the shell's old execution path.
Attributes such as open descriptors depend on their inheritance and close-on-exec settings, while other state is reset according to the platform contract. Do not assume replacement is a complete resource cleanup. Prepare the intended argument, environment and descriptor set deliberately.
56. What is a zombie process?
A zombie is a child that has terminated but whose exit status has not yet been collected by its parent or designated reaper. It no longer executes user code; the remaining process-table information allows the parent to learn how it ended.
Sending a kill signal does not perform the missing wait operation. The responsible parent should use an appropriate wait mechanism and handle all relevant child completions rather than assuming one notification corresponds to exactly one child.
A few short-lived zombies can occur naturally between exit and reaping, while persistent accumulation suggests a lifecycle bug. Diagnose the parent-child relationship and supervision policy. A zombie is different from a running orphan or a process blocked in the kernel, and those require different explanations and remedies.
57. What is an orphan process?
An orphan is a process whose original parent has exited while it may still be running. On Linux it is reparented to an appropriate subreaper or init process, which becomes responsible for the relevant child-management role.
This is different from a zombie, which has already terminated and is waiting to have its exit information collected. A process can become orphaned without being defective; supervised services and deliberately separated lifetimes may use such relationships.
The important design question is who owns termination, resource cleanup and exit-status collection. Do not rely on accidental orphaning as a substitute for a clear service lifecycle. Containers and subreapers also affect which process becomes the new parent, so ‘always PID 1’ is too simplistic.
58. Why is fork in a multithreaded process tricky?
After fork in a multithreaded process, only the calling thread exists in the child. Memory can still contain lock state left by other threads, which cannot run there to release it. Calling arbitrary library code before exec can therefore deadlock or violate library invariants.
POSIX places restrictions on operations in that interval; use only the permitted safe operations until program replacement. Do not assume that logging, allocation or a convenience runtime function is safe simply because it is harmless in an ordinary single-threaded program.
Prefer a suitable spawn interface when it expresses the needed setup. Fork handlers can help with selected invariants, but do not make arbitrary third-party library state safe.
59. How can file descriptors leak across exec?
File descriptors normally survive exec unless configured to close, so a newly executed program can inherit resources it was never intended to access. That can leak files, sockets or pipe ends and can also keep resources alive unexpectedly.
On Linux, use atomic close-on-exec creation flags where supported, such as the relevant CLOEXEC option, instead of creating a descriptor and setting the flag later. In a multithreaded process, another thread can fork and exec during that gap.
Define which descriptors are intentionally inherited and close the rest through the supported process-launch protocol. A leaked pipe writer can prevent EOF just as a leaked sensitive file can broaden access. Descriptor hygiene is part of correctness and isolation, not merely avoiding a small resource count increase.
60. How do pipes support interprocess communication?
A pipe provides a byte stream between read and write endpoints. It does not preserve an application's arbitrary message boundaries, so readers need a framing rule when several logical messages share the stream.
EOF appears after buffered data is consumed and no write ends remain open. If the parent forgets to close its unused copy of the writer after launching a child, a reader can wait indefinitely even though the intended writer has exited.
Close unused ends in every process and handle partial operations and errors. Pipe capacity and atomic-write guarantees apply under specific size and platform rules; one write is not a general promise of one matching read. Backpressure is useful, but the process design must avoid every participant waiting on a full or empty pipe in a cycle.
61. How does shared-memory IPC differ from message passing?
Shared memory gives processes access to a common region, avoiding some data-copy paths but requiring an explicit synchronization and lifetime protocol. Message passing exposes transfer boundaries, while its copying, buffering and ordering properties depend on the chosen mechanism.
For a shared ring buffer, producer and consumer must agree on ownership of each slot and safely publish when data is ready. Merely mapping the same pages does not make concurrent updates correct. Raw pointers may also be invalid in another process with a different mapping address.
A message queue can simplify ownership by transferring a serialized unit, but still needs capacity, failure and backpressure handling. Choose based on data volume, latency, isolation and recovery requirements rather than claiming shared memory is always faster or messages automatically prevent races.
62. What should code do after a partial write?
After a partial write, advance by the number of bytes actually accepted and continue with only the remaining portion. A positive return value is progress, not proof that the entire buffer was transferred. Handle blocking, interruption and nonblocking retry conditions according to the descriptor's contract.
If a ten-byte payload reports four bytes written, the next attempt begins at byte four, not at the beginning. Repeating all ten bytes duplicates the accepted prefix. A terminal error after progress also leaves an uncertain partial application message that the higher-level protocol must handle.
Avoid a busy loop when a nonblocking descriptor cannot accept more data; wait for appropriate readiness. A successful local write does not prove the remote application processed the message or that file data is durable. Those guarantees require separate acknowledgments or persistence protocols.
63. What does readiness notification guarantee?
Readiness means an operation can potentially make progress under the interface's rules, not that a complete application message is available. A readable socket may contain a partial header, payload bytes, EOF or an error condition that the next operation must interpret.
Another consumer or changing state can also affect what the subsequent operation observes. Use nonblocking I/O where appropriate and handle partial results and retry conditions rather than assuming the readiness event reserves all available data for one caller.
Keep parsing state across reads and enforce message-size limits. The event loop coordinates opportunities to do work; the protocol parser determines when a logical message is complete. Confusing these layers creates truncated-message bugs that may appear only under real network fragmentation.
64. How do level-triggered and edge-triggered epoll differ?
Linux epoll level-triggered mode continues reporting a descriptor while its readiness condition remains true. Edge-triggered mode reports relevant readiness transitions, so leaving unread work and then waiting for a new edge can strand data already available.
A common edge-triggered design uses nonblocking descriptors and reads or writes until EAGAIN indicates that immediate progress is exhausted. If an event reports several bytes and the handler reads only part before sleeping again, no new arrival may occur to wake it.
Also preserve fairness: draining a busy connection indefinitely can starve others, so a bounded handler may need an explicit ready queue rather than relying on another kernel edge. Handle EOF and errors separately. Edge-triggering changes the coordination protocol; it is not simply a faster flag for unchanged blocking code.
65. What is a signal?
A signal is a software notification with a configured disposition, such as invoking a handler, ignoring it or taking a default termination action. Delivery depends on masks, process or thread targeting and platform rules.
On Linux and POSIX-like systems, ordinary standard signals generally do not queue one separately countable instance for every repeated generation while pending. A child-status signal therefore should prompt checking for all available child state changes, not assuming exactly one child ended.
Signal handlers run in an unusual interruption context, so they cannot freely call ordinary application code. For multithreaded programs, define which threads block or accept relevant signals and how notification reaches the main coordination logic. Treat the notification as part of a protocol rather than a reliable general-purpose message queue.
66. Why must signal handlers use restricted operations?
A signal handler can interrupt a library operation while internal state is partly updated or a lock is held. Calling the same nonreentrant operation from the handler can corrupt state or deadlock. Use operations documented as async-signal-safe and keep the handler's own state access within the language and platform rules.
For example, buffered formatted output is not made safe merely because it prints a short message. A handler can instead communicate through a carefully designed minimal mechanism so ordinary code performs the complex work later.
Even an allowed operation needs error and capacity handling; a communication pipe must not let the handler block unexpectedly. Preserve relevant state such as errno when required by the design. Thread-safe and async-signal-safe are different guarantees, so a function's normal multithreading support is not sufficient.
67. What is the difference between SIGTERM and SIGKILL?
SIGTERM requests termination and can be handled or ignored, allowing a program to stop accepting work, finish or cancel owned tasks and release resources. SIGKILL cannot be caught, blocked or ignored, so it does not offer the program a cleanup opportunity.
A service manager can use a defined graceful-shutdown interval before escalating according to its policy. The application should make the SIGTERM path bounded and observable rather than assuming cleanup may run forever.
SIGKILL does not guarantee immediate disappearance if a task cannot yet leave certain kernel waits. It also does not complete application-level transactions or remove every external effect. Distinguish stopping execution from restoring business consistency; durable storage and recovery protocols must tolerate abrupt termination.
68. What is memory mapping?
Memory mapping associates a virtual address range with a file or anonymous storage under defined access and sharing protections. The program accesses that range through memory operations rather than explicit read and write calls for every byte.
A file-backed mapping can let the kernel bring pages into memory on demand, but access can still fault and incur I/O. Mapping a large file does not imply the entire file is resident or that every address remains safe if another actor truncates the backing file.
Respect bounds, object lifetime and synchronization between readers and writers. Mapping changes the interface, not the persistence contract: modified file-backed pages may need an explicit durability protocol. Choose private or shared behavior deliberately and handle platform-specific failure conditions.
69. How do MAP_PRIVATE and MAP_SHARED differ?
With Linux MAP_PRIVATE, modifications use private copy-on-write semantics and are not written back to the file through that mapping. MAP_SHARED permits shared visibility and file-backed updates, subject to the synchronization and persistence rules of the mapping.
A process privately mapping a configuration file can modify its own view without editing the file. A shared-memory producer and consumer can instead observe common state, but need a protocol to know when a complete update is ready.
Shared visibility is not the same as durable storage, and neither mode supplies an arbitrary multi-field transaction. Do not rely on private mappings to provide a portable snapshot of concurrent external file modifications. State the expected ownership and update behavior before choosing flags.
70. What is a working set?
A working set is the memory actively referenced over a relevant interval. It helps explain how much resident memory a workload needs to make progress without excessive faults, which can differ greatly from its total reserved virtual address space.
An application may reserve a large sparse address range but touch only a small portion. Another may repeatedly scan a dataset just larger than available memory, causing frequent replacement and poor throughput despite a modest-looking allocation.
Choose an observation interval appropriate to the phase of work, since startup and steady-state working sets can differ. Diagnose locality, resident use and fault behavior together. Reducing virtual allocation alone may not improve pressure if the actively accessed pages remain unchanged.
71. What is locality of reference?
Temporal locality means recently accessed data is likely to be used again; spatial locality means nearby locations are likely to be accessed. Caches and paging exploit these patterns by retaining recent data and moving blocks larger than one requested value.
A sequential array scan often uses many values from each fetched cache line, while pointer chasing across scattered nodes can fetch a line for very little useful data. Reusing a small lookup table repeatedly can benefit from temporal locality.
Algorithmic complexity does not capture all of this behavior. Two O(n) traversals can have very different memory costs. Layout, traversal order and working-set size matter, but optimization should preserve correctness and be measured on the target workload rather than assuming every contiguous structure always wins.
72. How do FIFO and LRU page replacement differ?
FIFO evicts the page loaded earliest, while ideal LRU evicts the page whose most recent access is oldest. FIFO does not update its eviction order on a hit; LRU does. That difference can change which useful page survives.
The fixture below models FIFO only:
For its reference string, three frames produce nine faults and four frames produce ten. This is a teaching simulation, not the policy of a current Linux kernel. Exact LRU can require costly access tracking, so practical systems use approximations and additional information about pages. Compare policy assumptions before applying a classroom fault count to a real workload.
73. What is Belady's anomaly?
Belady's anomaly is the possibility that adding frames increases page faults under some replacement policies, including FIFO. More capacity changes FIFO's eviction sequence, which can cause a page to be absent at a later reference even though the smaller cache retained it.
The FIFO reference sequence in the preceding fixture produces nine faults with three frames but ten with four. That concrete counterexample disproves the claim that every replacement policy must improve monotonically as capacity grows.
Ideal LRU is a stack algorithm: the resident set for a smaller capacity is contained in that for a larger capacity after the same reference prefix, preventing this anomaly. Do not generalize the FIFO result to all operating-system memory policies or treat it as evidence that adding RAM normally harms application performance.
74. How do minor and major page faults differ on Linux?
On Linux, a minor page fault can be resolved without reading the required page from backing storage, while a major fault involves that I/O. Both are faults in address translation or page availability, but their expected costs can differ substantially.
Minor faults can arise from normal demand allocation or copy-on-write activity. A high minor-fault count during startup is therefore not automatically evidence of swapping or a storage bottleneck. Major faults need context too, including file-backed access and cache state.
Compare rates, latency and workload phases rather than one cumulative count. A deliberately cold file scan and an application repeatedly exceeding its working-set capacity can produce different operational implications. Fault counters are evidence for diagnosis, not a standalone measure of memory health.
75. What does the page cache do?
The page cache retains file data in memory so repeated reads can avoid storage access and writes can be buffered. Memory used for cache is often reclaimable, so low completely free memory is not by itself proof that the system lacks usable memory.
Reading the same file twice may make the second pass much faster because pages are cached. That also means a warm-cache benchmark can overstate cold-start performance. Dirty cached pages require writeback rather than simply being discarded.
Assess reclaimability, writeback pressure, fault behavior and application latency together. Do not clear caches or change system settings merely to make a free-memory number look larger. The cache is doing useful work unless evidence shows a workload-specific pressure or persistence issue.
76. Does a successful write mean data is durable?
A successful write commonly means bytes were accepted into kernel-managed state, not that they are guaranteed to survive power loss. Applications requiring durability need the appropriate synchronization and error-handling protocol for their file system and storage stack.
For a saved document, writing new content and then reporting success can leave a failure window before storage persistence. Publishing a new filename or rename adds directory metadata considerations as well as file contents.
Separate acceptance, visibility and durability in the design. Check partial writes and deferred errors, and do not assume close alone supplies every guarantee. A crash-consistent file replacement sequence must coordinate the temporary file, synchronization and name change rather than relying only on the write return value.
77. What does fsync guarantee on Linux?
On Linux, fsync synchronizes a file's modified data and relevant metadata to storage and reports completion or an error. It is a file-specific operation; persisting the file's contents does not necessarily persist a newly created or renamed directory entry.
A durable publication protocol may therefore also synchronize the containing directory after the relevant name operation. Fdatasync differs by omitting metadata not needed to retrieve the data correctly, but size changes can still matter.
Handle failures instead of treating a call as success merely because it was attempted. The guarantee depends on the file-system and storage stack honoring the contract. Fsync also does not turn several independent files into one application transaction; coordinated recovery remains necessary.
78. What is journaling in a file system?
A journaling file system records selected changes so recovery can restore a consistent structure after interruption. The mode determines which data or metadata receives which ordering and recovery guarantees; ‘journaled’ is not one universal promise that every recent application write survives.
For example, a metadata journal can help prevent structural inconsistency while the latest file contents still require an application durability protocol. The file system can recover a valid directory tree without recovering the exact version the application intended to publish.
Journaling is not a backup: it does not protect against accidental deletion, corruption outside its guarantees or loss of the storage device. State the file system and mode when discussing specifics, and design application recovery around documented behavior rather than the presence of a journal alone.
79. What is the difference between a file offset and a descriptor?
A file descriptor is a process-local integer handle. For a seekable file, the current offset belongs to the underlying open file description, which can be referenced by more than one descriptor. The handle and the open-file state are therefore different objects.
Duplicating a descriptor or inheriting it through fork can share the offset. If one holder reads ten bytes, another holder may continue from the advanced position. Opening the same pathname separately normally creates a separate open file description with its own offset.
This matters when coordinating concurrent I/O. Use the appropriate explicit-offset operation when independent positions are required, and still consider overlapping writes and other shared state. Different descriptor numbers do not prove independent file offsets or ownership.
80. How does unlink affect an open file?
Unlink removes a directory entry, not every existing reference to the underlying file. An already open descriptor can continue accessing the file, and storage is generally reclaimed only after the last link and relevant open references are gone.
A service can keep writing to an unlinked log file through its old descriptor. The pathname disappears, but disk usage may remain until the service closes that reference. That explains why deleting a visible filename does not always free space immediately.
Hard links add another reference through a different name, and mappings or open handles affect lifetime as well. Diagnose ownership before changing anything. Unlink is a naming operation with lifecycle consequences, not a universal command to invalidate every user of the data.
Operating System Interview Questions and Answers for Experienced
These scenarios examine incidents, scalability and isolation. Look for competing hypotheses, measurements that distinguish them and changes that preserve correctness while addressing the demonstrated bottleneck.
81. How would you investigate high CPU usage?
Identify the consuming processes and threads, distinguish user from kernel time and collect representative profiles. Correlate with workload and recent changes before optimizing; a high utilization figure alone does not identify wasted work.
For example, a worker consuming one full core while a sixteen-core host looks mostly idle may be a single-thread bottleneck. If its profile is dominated by repeated parsing, optimize that path; if it is spinning on a lock, adding workers may worsen the problem. Compare CPU time per completed request and achieved throughput at equivalent load. A utilization drop caused by rejecting more requests is not evidence of a successful optimization.
82. How would you investigate high load with low CPU utilization?
Check runnable work, uninterruptible waits, storage latency and resource constraints using the platform's load definition. On Linux load includes certain waiting tasks, so it is not simply another expression of CPU percentage.
Suppose requests stall while many Linux tasks remain in uninterruptible sleep and the device queue grows. That supports an I/O-path investigation even though processors have spare capacity. Inspect the blocked stacks and storage latency to distinguish local disk saturation from a remote filesystem or driver problem. Also separate host-wide load from a service’s CPU quota: a throttled container can be slow on an otherwise idle host. Adding CPU capacity will not repair an unavailable storage dependency.
83. How would you diagnose a memory leak?
Track memory growth over time under a controlled workload and distinguish live allocations from caches, fragmentation and mapped files. Use appropriate allocation or heap evidence before declaring that every rise in resident memory is a leak.
A cache that grows during warm-up and then reaches a configured limit is different from allocations that remain reachable after every request. Repeat a fixed request cycle, allow expected cleanup, and compare retained object counts or allocation sites. If the heap stabilizes but resident memory does not fall, allocator retention or fragmentation may explain the gap. Track mapped and native memory as well as the language heap; otherwise a native buffer leak can be missed entirely.
84. How would you investigate an out-of-memory termination?
Inspect the relevant kernel or container events, limits and memory accounting to identify which resource boundary was exceeded. Compare actual working sets and allocation patterns rather than assuming the whole machine exhausted RAM.
For a Linux cgroup v2 service, inspect the applicable hierarchy and memory.events alongside its configured memory limits. A container may hit its own limit while the host still has free memory. Correlate the event with batch size, concurrent requests and file-cache usage; the killed process is not automatically the sole cause of pressure. A temporary limit increase may restore service, but recovery also needs a bounded working set or an explanation of why the previous capacity assumption failed.
85. What is memory overcommit?
Overcommit allows virtual allocations beyond immediately available backing resources under a policy. Allocation success therefore may not guarantee that every future page touch can be satisfied; policy and failure behavior are platform-specific.
A large reservation can succeed before the application writes to its pages, so a startup allocation test does not necessarily exercise peak physical demand. Consider a worker that reserves a large array but touches it only during a nightly job: failure can appear much later than allocation. On Linux, overcommit policy, swap and cgroup limits all affect the outcome. Capacity testing should represent touched working sets and concurrent jobs, rather than summing only virtual address-space sizes.
86. How do cgroups and namespaces differ?
Linux cgroups organize resource accounting and control, while namespaces isolate views of selected system resources. They solve different problems and are commonly combined in containers; neither alone provides every security boundary.
For example, a PID namespace can give a container its own process-number view, but it does not cap the CPU that those processes consume. A CPU controller can limit consumption without hiding other resources. Resource controls are hierarchical, so an apparently generous child setting cannot override a tighter applicable ancestor limit. When diagnosing a container, inspect both its isolation context and effective resource boundaries; a process view that looks private is not evidence of dedicated hardware.
87. How do containers differ from virtual machines?
Containers commonly share the host kernel while isolating selected resources and views. Virtual machines run guest operating systems on virtualized hardware, offering a different isolation and compatibility boundary with different overheads.
A Linux container cannot simply supply an unrelated guest kernel to an application that requires one; a virtual machine can provide that separate kernel environment. Sharing the host kernel makes container startup and density attractive, but also makes host-kernel compatibility and isolation particularly important. For untrusted workloads, compare the actual threat model, runtime hardening and operational controls instead of assuming the packaging format determines security. Virtualization also does not eliminate noisy-neighbor effects in shared CPU, memory or storage.
88. What is a capability in Linux?
A Linux capability is a specific privilege separated from the traditional all-powerful root model. Evaluate effective capabilities and namespace context rather than assuming a nonzero user ID or a container automatically implies minimal privilege.
A service that needs one privileged operation should not receive a broad privilege set just because it runs in a container. Examine permitted, effective and inherited privilege paths together with the user-namespace context. For instance, granting a powerful capability to simplify setup may expose operations unrelated to serving requests. Prefer separating the privileged initialization step from the long-running request handler when feasible, and verify that child processes cannot unexpectedly regain privileges through execution or configuration.
89. How would you apply least privilege to a service?
Give the service only the identities, file access and specific privileges needed for its function, and isolate sensitive dependencies. Validate normal operation and recovery under those restrictions rather than broadly granting privileges to eliminate errors.
For a report service, allow reads from the input area and writes only to its output area; do not make its application directory writable merely to solve a temporary-file error. Give secrets separate access rules and avoid exposing unrelated credentials to child processes. Exercise log rotation, restart and failed dependency handling under the same restrictions. Otherwise a service may pass a happy-path test but require emergency privilege expansion during the first recovery operation.
90. What is a time-of-check to time-of-use race?
State can change between validating a resource and acting on it, so the action may affect a different or no-longer-valid object. Prefer APIs that bind validation and use to stable handles or perform the required operation atomically.
A classic case checks that a pathname belongs to an allowed user, then opens that pathname later. Between those operations, another actor replaces the object, so the check describes something different from the opened file. Opening a stable handle and inspecting that handle can remove this identity mismatch, provided the open itself follows the required access and path policy. Repeating the path check does not close the race; correctness requires reasoning about the operation’s atomic boundary.
91. How can a symbolic-link race affect file operations?
An attacker or concurrent actor may replace a path component between checks and access, redirecting the operation. Use appropriate directory-relative and no-follow mechanisms with a defined threat model instead of trusting a prior path inspection.
A no-follow flag that protects only the final component is insufficient when an attacker can alter an intermediate directory. On Linux, openat2() offers resolution constraints such as RESOLVE_BENEATH and RESOLVE_NO_SYMLINKS for suitable policies. Choose the constraints intentionally: confinement beneath a trusted directory and forbidding all symbolic links are different requirements. Treat unsupported APIs and resolution errors as explicit failures, rather than silently falling back to an unsafe check-then-open sequence.
92. How do NUMA systems affect performance?
Memory access costs can depend on which processor and memory node hold the data. Placement, first-touch behavior and workload migration matter; pinning everything without measurement can reduce flexibility and worsen imbalance.
Imagine one thread initializes a large data structure on one NUMA node, then workers on other nodes repeatedly scan it. Remote accesses may increase latency and consume interconnect bandwidth even with spare CPU capacity. Parallel initialization with appropriate placement can help, but a later workload rebalance may change which placement is best. Compare local versus remote access behavior and throughput before pinning workers; rigid affinity can leave one node overloaded while another has idle processors.
93. What is false sharing?
Independent variables can share a cache line, causing coherence traffic when different processors modify them. Padding or reorganizing hot data may help, but confirm the pattern through measurement rather than assuming every concurrency slowdown is lock contention.
For example, each worker may update its own counter without sharing a logical variable, yet adjacent counters occupy the same cache line. Writes then repeatedly transfer ownership of that line between cores. Per-worker storage and aggregation outside the hot path can reduce this traffic; padding increases memory consumption and may harm cache density elsewhere. The following address arithmetic explains the layout condition only: it does not measure a processor or demonstrate an actual performance improvement.
Python teaching example: assumed cache-line placement
94. Why can more threads reduce throughput?
Additional threads can increase contention, context switches, cache pressure and scheduling overhead beyond useful parallelism. Measure the actual bottleneck and queueing behavior, then choose concurrency appropriate to CPU, I/O and shared resources.
Suppose all requests acquire one lock before updating a shared index. Doubling workers can lengthen the wait queue without increasing the rate at which the critical section completes. CPU-bound workers can also compete beyond the CPUs available to their cgroup, even when the host has many cores. Compare useful throughput, tail latency and runnable or blocked time as concurrency changes. Bound admission as well as active workers, or a smaller pool may simply move the same overload into an unbounded queue.
95. What is the difference between concurrency and parallelism?
Concurrency concerns multiple activities making progress over overlapping periods, while parallelism means simultaneous execution. A single core can support concurrent tasks through scheduling without executing their instructions simultaneously.
A single-thread event loop can keep many network requests in flight by switching work when each request waits, but one long CPU-bound callback prevents the loop from advancing other requests. Moving independent computation onto multiple cores introduces parallelism and may require synchronization for shared state. The useful interview distinction is therefore about execution and dependencies: concurrent design can improve responsiveness around waiting, while parallel execution helps only where enough work can proceed independently.
96. How would you choose between a thread pool and an event loop?
Consider blocking dependencies, CPU work, request volume and programming complexity. Event loops require bounded nonblocking handlers, while pools need bounded queueing and careful sizing; hybrid designs are often appropriate.
For many mostly idle connections, readiness-based I/O can avoid dedicating a blocked thread to every connection. But a synchronous DNS lookup, filesystem call or expensive compression step inside a callback can stall unrelated clients. Offload bounded blocking work to a pool and propagate cancellation and deadlines across that boundary. Conversely, a modest service using blocking libraries may be easier to reason about with a bounded thread pool. Choose based on dependency behavior, not connection count alone.
97. How would you detect a deadlock in a running service?
Capture thread stacks and lock ownership or wait relationships, then look for a stable dependency cycle. Preserve evidence before restarting when feasible, and distinguish deadlock from slow I/O, starvation or a missed notification.
If thread A owns lock X and waits for Y while thread B owns Y and waits for X, the ownership graph supplies a concrete cycle. Repeated snapshots help establish that the waits are stable rather than transient. A set of threads all waiting for a network response is not sufficient evidence of deadlock. After containment, correct the protocol—for example, establish one lock order—and test the conflicting acquisition paths, including cleanup and error handling where reversed order is often hidden.
98. How would you reduce lock contention?
Measure hold times and contention sites, then shorten critical sections, partition state or change data ownership where justified. More complex lock-free designs introduce their own correctness and reclamation challenges and should not be the default remedy.
A shared statistics lock may be hot because every request performs logging or formatting while holding it. Moving that independent work outside the critical section can help without changing the ownership model. If the protected update itself is the bottleneck, partitioning by tenant or using per-worker counters may work, but readers must tolerate or reconcile distributed state. Check whether the application needs an exact instantaneous total; a faster design that violates that requirement is not an equivalent replacement.
99. What do lock-free and wait-free mean?
Lock-free algorithms guarantee system-wide progress under their model, while wait-free algorithms bound each operation's completion steps. Neither label automatically guarantees low latency on a real system with scheduling delays or resource exhaustion.
A compare-and-swap loop can be lock-free when some contender always makes progress, yet one unlucky thread may retry indefinitely. That is insufficient for a wait-free per-operation guarantee. Moreover, the full operation may call a blocking allocator or wait for reclamation even if its central update loop is nonblocking. Specify the algorithm and assumptions to which the guarantee applies. Neither a progress proof nor the absence of a mutex gives a wall-clock deadline on a preemptive operating system.
100. What is the ABA problem?
A value can change from A to B and back to A, allowing a comparison to miss an intervening state change. Version tags or suitable memory-reclamation schemes can address particular cases, but the solution must match the algorithm's invariants.
In a stack, a thread can read head address A, pause, and later see A again after another thread removed nodes and reused that address. Its comparison succeeds even though the stack relationship it relied on has changed. A generation tag helps distinguish incarnations, but tag wraparound and atomic update width must be considered. Safe reclamation can prevent particular reuse hazards; it does not automatically eliminate every logical ABA pattern in every algorithm.
101. Why is memory reclamation difficult in concurrent structures?
Removing a node does not prove no other thread still holds a reference to it. Techniques such as hazard pointers, epochs or reference counting require explicit lifetime rules and have different cost and progress tradeoffs.
Consider a reader that loads a node pointer immediately before another thread unlinks the node. Freeing it at unlink time leaves the reader with a dangling reference even though the container no longer points to it. Hazard pointers announce protected references; epoch schemes defer freeing until relevant readers have advanced. A stalled reader can delay reclamation and cause memory growth. Evaluate that retention behavior separately from update progress, especially for services whose threads may pause for long periods.
102. What does a read-copy-update approach achieve?
RCU-style designs allow readers to access published versions while updates create replacements and defer reclamation until prior readers are finished. It is useful for read-heavy workloads but requires a correct grace-period and update protocol.
A read-mostly routing table is a good example: publish an initialized replacement, let existing readers finish using the old version, then reclaim the old storage. Publication and reader access must use the required ordering primitives, and concurrent writers still need coordination. RCU does not imply that a reader sees an all-fields transactional snapshot unless the data design provides one. Long readers or frequent replacement can also retain substantial old state while reclamation waits.
103. What makes real-time scheduling different?
Real-time systems prioritize meeting timing constraints under a defined workload and failure model. High average speed is insufficient; bounded worst-case behavior, resource blocking and overload handling matter.
For a periodic controller, the question is whether every required computation finishes before its deadline under stated interference, not whether average throughput is high. Account for interrupt handling, priority inversion, page faults and bounded critical sections. Overload needs an explicit policy, such as dropping obsolete work or entering a safe state. Giving a thread real-time priority alone is not a schedulability proof and can starve essential lower-priority work if that thread runs without appropriate bounds.
104. How do hard and soft real-time requirements differ?
A hard deadline miss is unacceptable under the system's specified correctness requirements, while soft real-time systems tolerate some misses with degraded utility. State the actual consequence and measurement model instead of labeling any low-latency service hard real-time.
An audio playback glitch may be tolerable as degraded quality, whereas missing a deadline in a safety-critical actuator may violate the system’s correctness conditions. The classification follows the application contract, not a particular millisecond threshold. A soft real-time service still needs a useful deadline distribution and an overload policy. For hard requirements, explain the bounded workload and evidence supporting the worst-case claim; a good 99th percentile explicitly leaves some executions outside that bound.
105. Why is a scheduler description version-dependent?
Operating systems evolve scheduling algorithms, classes and tunables, and configuration changes behavior. For example, Linux documentation describes CFS giving way to EEVDF; explain the target kernel and workload rather than asserting one universal current algorithm.
For Linux fair-class scheduling, older explanations often focus on choosing by virtual runtime under CFS; current kernel documentation describes EEVDF using eligibility and virtual deadlines. That does not replace all scheduling classes with one policy: real-time and deadline scheduling have separate contracts. Ask which kernel, distribution backports and class are in use before diagnosing behavior. A tuning recommendation copied from an older scheduler description may address a mechanism that no longer behaves the same way.
106. How do CPU affinity and scheduling priority differ?
Affinity constrains where work may run, while priority influences selection among eligible work under the scheduling policy. Restricting affinity can improve locality or create a bottleneck, so it is not a general substitute for priority or capacity planning.
A latency-sensitive thread pinned to one busy CPU can wait while other CPUs are idle. Raising its priority changes competition where it may run, but does not expand that allowed CPU set or remove a cgroup bandwidth limit. Affinity can preserve cache locality or align work with NUMA memory, at the cost of scheduler flexibility. When testing a change, examine the permitted processors, competing work and interrupt placement together; aggregate host utilization can hide a local bottleneck.
107. How can huge pages help or hurt?
Larger pages can reduce translation overhead and page-table size for suitable workloads. They can also increase allocation constraints, memory waste or latency, so measure the target workload and configuration rather than enabling them indiscriminately.
A large in-memory scan may benefit when fewer translation lookaside buffer entries cover its working set. A sparse allocation may instead waste space within large pages, and obtaining contiguous memory can add allocation or compaction costs. Distinguish explicit huge-page allocation from transparent huge pages because their reservation and fallback behavior differ. For a latency-sensitive service, inspect tail pauses as well as scan throughput; improving average translation efficiency can still create unacceptable allocation-time spikes.
108. How would you design a crash-safe file replacement?
Write a complete temporary file in the appropriate file system, synchronize it as required, rename it into place and synchronize relevant directory metadata according to the platform's guarantees. Check every error and test failure points; atomic namespace replacement alone is not durable recovery.
For a single-file replacement on an appropriate Linux filesystem, create a uniquely named temporary file in the destination directory, write the full contents, check synchronization, rename within that filesystem and synchronize the containing directory. Keep permissions and ownership correct before exposing the new file. If any step fails, report the actual outcome and retain recoverable evidence. This is a protocol to validate against the filesystem and storage stack; it does not create a transaction across several independent files.
109. How does atomicity differ from durability?
Atomicity concerns whether an operation appears indivisible, while durability concerns whether acknowledged changes survive the specified failures. A rename can provide atomic visibility without alone proving that its result will survive power loss.
Readers opening a pathname during an atomic replacement should obtain an old or new file identity rather than a half-replaced directory entry. A process already holding the old file open can continue using that object. Durability asks a separate question: after a crash, which acknowledged version can recovery rely on? That depends on successful synchronization and the relevant storage guarantees. Define both the concurrent-reader contract and the crash-recovery contract instead of using “atomic” as shorthand for all persistence properties.
110. How would you handle disk-full errors safely?
Stop claiming successful persistence, retain recoverable state where possible and surface the failed operation to the caller. Account for partial writes and metadata failures, and avoid blindly retrying indefinitely against an unchanged full volume.
A buffered write can appear successful before delayed allocation or writeback reports an error, so checking only the first write is insufficient. Handle short writes and later synchronization errors, and avoid deleting the last valid version before a replacement is safe. Distinguish exhausted space from an inode or quota limit when diagnosing the cause. A bounded retry can be appropriate after capacity is restored; an immediate retry loop merely consumes resources while concealing that persistence has failed.
111. How would you investigate a file-descriptor leak?
Track descriptor counts and types over repeated operations, then map growth to missing cleanup or unexpected inheritance. Raising the limit can postpone failure but does not correct an unbounded leak.
If every failed upstream connection leaves one socket behind, the count may rise only during outages rather than normal traffic. Compare descriptor types and lifecycle paths during successful, timeout and cancellation cases. Also inspect child-process inheritance: the parent closing a pipe endpoint does not release an inherited copy in a child. Fix ownership so each successful acquisition has cleanup on every exit path, then rerun repeated failure cycles to establish that the count returns to a stable baseline.
112. What is backpressure in an operating-system context?
Backpressure limits incoming work when downstream capacity is exhausted, using bounded buffers, blocking or explicit rejection. Without it, queues can convert a throughput mismatch into memory exhaustion and extreme latency.
Suppose a producer submits 150 jobs per second while a consumer can finish only 100. An unbounded queue accumulates 50 jobs per second and eventually turns sustained overload into a memory incident. A bounded queue makes the policy explicit: block producers, reject work or discard only work the application permits losing. Carry deadlines through the queue so expired jobs do not consume scarce capacity. Backpressure must reach the source; bounding one stage is ineffective if an earlier stage buffers without limit.
113. How do wall-clock and monotonic time differ?
Wall-clock time represents civil time and can be adjusted, while a monotonic clock is intended for measuring elapsed intervals without backward jumps under its contract. Choose the clock according to whether the task is timestamping or timing, and check suspend behavior on the platform.
Use wall time to record when an incident happened, and an appropriate elapsed-time clock to enforce a request timeout. On Linux, CLOCK_MONOTONIC excludes suspended time, while CLOCK_BOOTTIME includes it; choose according to whether a timeout should expire while the machine sleeps. Monotonic values also should not be treated as portable civil timestamps. A clock that never jumps backward can still have resolution and adjustment characteristics relevant to very short measurements.
114. How would you test a concurrent component?
Combine invariant-based tests, controlled interleavings, stress runs and suitable race-detection tools. Passing a stress test does not prove all interleavings safe, so reason about the synchronization protocol as well as observed outcomes.
For a queue, assert that each accepted item is consumed at most once and that completed operations obey the specified ordering. Introduce barriers around contested transitions to exercise specific races rather than relying only on random delays. Record operation histories for checking against the intended sequential model when appropriate. Race detectors can find unsynchronized memory access but do not prove higher-level invariants: a perfectly synchronized implementation can still lose an item through an incorrect state transition.
115. How would you benchmark a system-call-heavy workload?
Measure representative operations, batching, concurrency and error paths while accounting for warm caches and measurement overhead. Separate user-space work from kernel transitions and I/O waiting so optimization targets the actual cost.
For example, comparing one-byte writes with batched writes can expose transition and buffering overhead, but the comparison must preserve the required delivery semantics. Include completed bytes or requests, latency distribution and error counts, not just loop iterations per second. A warm-cache file test answers a different question from storage-limited reads, and tracing can perturb a very short operation. Establish what reaches the kernel and what the library buffers before attributing a result to system-call cost.
116. How do security mitigations affect performance analysis?
Isolation and speculative-execution mitigations can change transition, memory and workload costs. Measure under the intended security configuration rather than recommending disabling protections to improve a benchmark.
A workload dominated by frequent user/kernel transitions may respond differently to mitigations than one that spends long periods computing in user space. Record kernel, hardware and relevant configuration with the result so a later comparison is meaningful. If an upgrade changes latency, isolate workload and configuration changes before assigning causality. Seek compatible improvements such as batching or reducing unnecessary transitions; changing the security posture would require a separate risk decision and is not an ordinary performance fix.
117. How would you recover from a kernel panic?
Follow the approved recovery procedure, preserve crash evidence and restore service through a known-good environment when necessary. Analyze logs, dumps and recent changes before attributing the failure to an application or applying an untested kernel change.
If a panic follows a driver update, a known-good rollback may be reasonable containment, but the temporal association is only a hypothesis. Preserve the panic trace, build identifiers and available dump evidence, then examine the failing stack and hardware or driver context. Restrict dump access because memory images can contain sensitive data. Verify service and data consistency after recovery, and reproduce in an appropriate test environment before declaring the underlying fault resolved.
118. How would you explain platform-specific assumptions in an interview?
State the operating system, architecture and relevant API contract before reasoning about behavior. Separate general concepts from Linux, POSIX or other implementation details, and identify where version or configuration could change the answer.
For example, “rename provides atomic replacement within this filesystem’s supported contract” is more defensible than “all file updates are atomic.” Similarly, Linux cgroup behavior is not a generic POSIX feature, and one CPU architecture’s ordering behavior is not a language-level synchronization guarantee. State the assumption where it affects the conclusion, then explain what would change on another platform. This demonstrates transferable reasoning while avoiding implementation details masquerading as universal operating-system rules.
119. What should an operating-system incident report include?
Document impact, timeline, measured resource behavior, relevant versions, containment and the evidence supporting the cause. Record unresolved uncertainty and follow-up validation rather than treating a restart that restored service as proof of root cause.
An actionable report might connect a deployment’s increased worker count to memory growth, a cgroup limit event and the resulting restart, with timestamps and retained measurements. Separate confirmed facts from suspected amplification, such as a retry surge whose size was not captured. Include the containment tradeoff, recovery validation and a prevention action with an owner and observable success criterion. “Restart fixed it” describes service restoration; it does not establish why the service failed.
120. What demonstrates senior operating-system judgment?
A senior candidate connects scheduling, memory, concurrency, I/O and protection to observable application behavior. They preserve correctness while measuring bottlenecks, handle failures explicitly and distinguish a plausible explanation from evidence.
For example, when latency rises despite low host CPU, a senior engineer considers blocked I/O, per-container throttling and lock serialization, then seeks evidence that separates those explanations. They choose containment that protects data and bounds further damage, preserve diagnostic information, and test the proposed cause against observed behavior. Their recommendation includes the consequence of being wrong and a way to validate recovery. Knowing terminology matters, but connecting mechanisms to a falsifiable incident explanation demonstrates deeper judgment.
Operating System Documentation and Further Reading
The following primary references cover the general teaching model and the explicitly identified Linux interfaces. API and kernel details depend on the target version and configuration.
Similar Posts
