Operating systems interview questions for systems and infrastructure roles

Operating systems interview questions for systems and infrastructure roles go past textbook definitions: they ask how a kernel is structured, how an address really gets translated, how a hypervisor or container isolates work, and how you would design a small piece of an OS such as an allocator or a lock. Expect fundamentals first, then mechanism questions where you trace hardware and kernel steps in order, then senior scenarios that join theory to a production symptom. Strong answers name the mechanism, its cost and the trade-off another design would make.

By Published 11 min read

Who gets these questions, and how they differ from a campus OS round

Freshers usually meet operating systems as one of the CS fundamentals subjects, and that syllabus is covered on our operating system interview questions page. This page is for the next step: candidates for systems software, kernel and driver work, embedded and firmware jobs, SRE and platform teams, database and storage engineering, and backend roles where performance matters. Those interviewers assume you know what a process is. They want to hear what the CPU and kernel actually do, in what order, and what it costs.

Formats vary by company. Common ones are a deep-dive conversation that keeps asking "and then what happens?", a whiteboard design of an OS component, a debugging discussion built around a real incident, and, for kernel or embedded teams, C coding with pointers, bit manipulation and concurrency. Some teams add a take-home that involves writing a small allocator, a shell or a user-space thread library.

Fundamentals: kernel structure, boot and the hardware boundary

Fundamentals questions for systems roles
QuestionWhat it testsWhat a strong answer shows
Monolithic kernel, microkernel, hybrid: what is the real difference?ArchitectureWhere drivers, file systems and networking run. Monolithic puts them in one privileged address space, so calls are cheap but one bad driver can crash everything. A microkernel moves them into user-space servers that talk through messages, trading speed for isolation. Linux is monolithic with loadable modules; Windows NT and Apple's XNU are usually described as hybrids.
What happens between pressing the power button and the first user process?Boot chainFirmware (UEFI or BIOS) initializes hardware and loads a boot loader, which loads the kernel image and often an initial RAM disk. The kernel sets up memory management, interrupts and drivers, mounts the root file system and starts the first user-space process (init or systemd on most Linux systems).
What are protection rings, and which ones do mainstream OSes use?Privilegex86 defines four rings but mainstream kernels use two: ring 0 for the kernel and ring 3 for applications. Virtualization extensions add a separate root mode for the hypervisor rather than using rings 1 and 2.
Walk through a system call at the instruction level.MechanismUser code places a call number and arguments in registers and executes a dedicated instruction (syscall on x86-64). The CPU switches to kernel mode and jumps to a fixed entry point, the kernel validates arguments, runs the handler, puts the result in a register and returns to user mode.
Why are some calls, such as reading the time, served without a full system call?OptimizationLinux maps a small shared library called the vDSO into each process so calls like clock_gettime can read kernel-maintained data from user space and skip the mode switch.
Hardware interrupt, exception and software interrupt: how do they differ?Event sourcesA hardware interrupt arrives asynchronously from a device. An exception is caused by the current instruction (divide by zero, page fault). A software interrupt or trap instruction is raised on purpose, historically how system calls were made.
Why split interrupt handling into a top half and a bottom half?LatencyThe top half runs with some interrupts masked, so it does the minimum (acknowledge the device, grab data) and defers the rest. Bottom halves (softirqs, tasklets, workqueues on Linux) finish the work later with interrupts enabled.
What is a kernel module, and what can go wrong with one?ExtensibilityCode loaded into the running kernel, usually a driver. It runs with full privilege, so a bug can corrupt kernel memory, and it is tied to the kernel's internal interfaces, which can change between versions.
What does the kernel keep per thread versus per process?Data structuresPer thread: registers, a kernel stack, scheduling state and signal mask. Per process: the address space, open file table, credentials and resource limits. On Linux both are tasks that differ in which resources they share.
Why does an OS need a timer interrupt at all?PreemptionWithout a periodic or programmed timer, a running task that never blocks would keep the CPU forever. The timer gives the scheduler a chance to run. Tickless kernels program the next timer only when needed to save power.
Fundamentals questions for systems roles. Scroll sideways on a small screen.

Intermediate: address translation, allocators and memory pressure

Memory questions in systems rounds stop being about definitions and start being about bits. Expect to split an address by hand, estimate the cost of a translation miss and explain what a kernel does when memory runs low.

  • How does a 4-level page table on x86-64 translate an address? With 4 KiB pages, the low 12 bits are the offset and the next 36 bits are four 9-bit indexes, one per level. Each level's table has 512 eight-byte entries, which is exactly one page. A miss in the TLB costs up to four memory reads before the data access itself.
  • What are huge pages and when do they help? Pages of 2 MiB or 1 GiB on x86-64. One TLB entry covers far more memory, so large heaps and databases see fewer TLB misses. The costs are wasted memory inside partly used pages and, with transparent huge pages, occasional latency from compaction.
  • What does the TLB do on a context switch? Without tagging, switching address spaces flushes it. Process-context identifiers (PCID on x86, ASIDs on Arm) tag entries so they can survive a switch.
  • What is a TLB shootdown? When one core changes a mapping shared with other cores, it must tell them to invalidate stale entries, usually with an inter-processor interrupt. Frequent munmap calls on many-core machines make this visible.
  • How does `mmap` of a file work? The kernel creates a mapping without reading anything. Touching a page faults, the kernel finds the page in the page cache or reads it, then maps it. Writes to a shared mapping dirty the cached page, which is written back later.
  • What is memory overcommit? Linux by default lets processes reserve more virtual memory than RAM plus swap, betting that not all of it will be touched. When the bet fails, the out-of-memory killer picks a victim.
  • What is NUMA and why does it matter to a server application? On multi-socket machines each CPU has local memory that is faster than remote memory. Pinning threads and allocating memory on the same node avoids paying the remote latency on every access.
  • How does a general-purpose allocator such as malloc get memory from the OS? Small allocations come from arenas the allocator already holds, grown with brk or mmap. Large ones are often served by a dedicated mmap and returned directly on free. Per-thread caches reduce lock contention.
  • What is a slab allocator and why do kernels use one? It keeps caches of pre-sized objects (inodes, task structs) in pages dedicated to one size, which avoids fragmentation and lets freed objects be reused quickly, sometimes already initialized.
  • How does a buddy allocator work? Memory is managed in power-of-two blocks. A request is rounded up, a larger free block is split in halves until it fits, and on free a block merges with its buddy if that buddy is also free. Finding the buddy is one XOR on the offset.
def split_x86_64(vaddr):
    """Split a 48-bit x86-64 virtual address (4 KiB pages, 4-level tables)."""
    offset = vaddr & 0xFFF                 # low 12 bits: byte within the page
    indexes = []
    for shift in (39, 30, 21, 12):         # PML4, PDPT, PD, PT
        indexes.append((vaddr >> shift) & 0x1FF)   # 9 bits = 512 entries
    return indexes, offset


idx, off = split_x86_64(0x00007F3A12345678)
print("PML4, PDPT, PD, PT:", idx)   # [254, 232, 145, 325]
print("offset:", hex(off))          # 0x678
Splitting a 48-bit x86-64 virtual address into its four page-table indexes and the page offset, assuming 4 KiB pages. Interviewers often ask for this by hand.
class Buddy:
    """Toy buddy allocator over a power-of-two arena (sizes in bytes)."""

    def __init__(self, size, min_block=64):
        self.size, self.min = size, min_block
        self.free = {size: [0]}            # block size -> list of free offsets
        self.used = {}                     # offset -> block size

    def alloc(self, n):
        want = self.min
        while want < n:
            want *= 2                      # round up to a power of two
        size = want
        while size <= self.size and not self.free.get(size):
            size *= 2                      # find the smallest free block that fits
        if size > self.size:
            return None
        off = self.free[size].pop()
        while size > want:                 # split, keeping the upper half free
            size //= 2
            self.free.setdefault(size, []).append(off + size)
        self.used[off] = want
        return off

    def release(self, off):
        size = self.used.pop(off)
        while size < self.size:
            buddy = off ^ size             # the buddy differs in exactly one bit
            peers = self.free.get(size, [])
            if buddy not in peers:
                break
            peers.remove(buddy)            # merge with the free buddy
            off, size = min(off, buddy), size * 2
        self.free.setdefault(size, []).append(off)


heap = Buddy(1024)
a = heap.alloc(100)    # rounded up to 128
b = heap.alloc(60)     # rounded up to 64
print(a, b, heap.used)                                # 0 128 {0: 128, 128: 64}
heap.release(a)
heap.release(b)
print({k: v for k, v in heap.free.items() if v})     # {1024: [0]}
A toy buddy allocator: requests round up to a power of two, blocks split on allocation and merge with their buddy on release.

Intermediate: virtualization, containers and isolation

Virtualization and container questions
QuestionWhat it testsWhat a strong answer shows
Type 1 versus type 2 hypervisor?BasicsA type 1 hypervisor runs directly on the hardware and hosts guests; a type 2 runs as an application on a host OS. The line has blurred, since KVM turns Linux itself into a hypervisor.
How do hardware virtualization extensions help?MechanismIntel VT-x and AMD-V let the guest kernel run its privileged code directly, while sensitive operations cause a VM exit to the hypervisor. Before them, hypervisors relied on binary translation or paravirtualized guests.
What are nested or extended page tables?Memory virtualizationThe guest maps its virtual addresses to guest-physical ones, and a second hardware-walked table maps guest-physical to host-physical. This removes shadow page tables but makes a TLB miss more expensive.
What is paravirtualization? Give an example.I/OThe guest knows it is virtualized and uses efficient interfaces instead of emulated hardware. Virtio network and block devices are the common example.
Container versus virtual machine?Isolation modelA VM runs its own kernel on virtual hardware. Containers are ordinary processes on the host kernel, separated by namespaces and limited by cgroups, so they start fast but share the kernel's attack surface.
Which Linux namespaces exist, and what does each hide?DetailPID, mount, network, UTS (hostname), IPC, user and cgroup namespaces, plus a time namespace on recent kernels. Each gives a process its own view of that resource.
What do cgroups control?Resource limitsCPU shares and quotas, memory limits, I/O bandwidth and process counts for a group of processes. Hitting a memory limit triggers an out-of-memory kill inside that group.
How do seccomp and capabilities harden a container?SecurityCapabilities split root's power into pieces so a process keeps only what it needs. Seccomp filters which system calls a process may make at all.
Why do some platforms run containers inside lightweight VMs?Trade-offTo get a separate kernel per tenant for stronger isolation while keeping fast startup. Firecracker and gVisor-style sandboxes are examples people cite.
Virtualization and container questions. Scroll sideways on a small screen.

Intermediate: OS security and the storage stack

  • What do ASLR, NX and stack canaries each stop? Address space layout randomization makes addresses hard to predict. The no-execute bit stops data pages, such as the stack, from running code. A canary placed before the return address detects many stack buffer overflows before the function returns.
  • What are SMEP and SMAP? CPU features that stop the kernel from executing (SMEP) or casually reading and writing (SMAP) user-space memory, which blocks a class of exploits that trick the kernel into jumping to attacker pages.
  • Discretionary versus mandatory access control? With DAC, owners set permissions on their files. With MAC, a system-wide policy (SELinux, AppArmor) decides, and even root is constrained by it.
  • What was the lesson of Meltdown-style attacks for OS design? Speculative execution could leak kernel memory into user space through cache timing. Kernels responded by unmapping most kernel memory while user code runs (page table isolation), which made system calls more expensive.
  • Trace a `read` call from the application to the disk. The call enters the virtual file system layer, which finds the file system's implementation. If the data is in the page cache it is copied out. On a miss, the file system maps the file offset to blocks, the block layer queues and possibly merges requests, an I/O scheduler orders them, and the driver submits them to the device. Completion arrives as an interrupt.
  • What does `O_DIRECT` change? It bypasses the page cache so the application manages its own caching, which databases sometimes want. Alignment rules apply, and misuse is slower than the cached path.
  • Copy-on-write file systems versus journaling ones? Journaling file systems (ext4, NTFS) log changes before applying them in place. Copy-on-write designs (Btrfs, ZFS, APFS) never overwrite live blocks, which makes snapshots cheap but can fragment files under random writes.
  • Why are SSDs and NVMe changing the I/O path? They serve many requests in parallel with low latency, so per-request kernel overhead matters. Multi-queue block layers and interfaces such as io_uring reduce system calls and copies per operation.

Senior and scenario questions: design a piece of the OS

Design and debugging scenarios for experienced candidates
QuestionWhat it testsWhat a strong answer shows
Design a mutex for a multicore kernel.Synchronization designStart with an atomic compare-and-swap on a lock word, spin briefly in case the holder is about to release, then sleep on a wait queue. Cover fairness, wake-ups without thundering herds and what happens if an interrupt handler needs the same lock.
Design a timer facility that handles a million pending timeouts.Data structuresA hierarchical timing wheel gives constant-time insert and cancel, or a min-heap if exact ordering matters more. Discuss timer granularity, cancellation races and per-CPU wheels.
Design a user-space thread library.SchedulingMany green threads on a few OS threads, with context switching by saving registers and swapping stacks. Blocking system calls must become non-blocking or move to helper threads, or one blocked call stalls everything.
A latency-sensitive service shows tail latency spikes every few seconds. What could the OS be doing?Production debuggingCandidates include memory compaction or huge page defragmentation, page cache writeback storms, CPU frequency changes, noisy neighbors on shared cores, and interrupts landing on the service's cores. Measure before tuning.
A process is stuck and cannot be killed. Why?Process statesOn Linux it is probably in uninterruptible sleep inside the kernel, often waiting on storage or a network file system. A kill signal is only delivered when it returns. The fix is the stuck I/O, not the signal.
A database on a two-socket server runs slower than on a smaller box. What do you check?NUMAWhether its threads and memory sit on different nodes, how interleaving is configured, and whether one node's memory is exhausted, forcing remote allocations or swapping.
How would you add a new system call, and why might you avoid doing so?Interface designDefine the number and handler, check arguments, copy data safely across the user boundary and document it. Kernel interfaces are kept stable for user space, so many teams prefer an existing interface (ioctl, a file in a pseudo file system, eBPF) first.
Port a component from Linux to Windows. What OS differences bite first?Cross-platformProcess creation (no fork; CreateProcess), handles instead of file descriptors, different async I/O models (completion ports versus readiness), path and permission rules, and signals not existing in the same form.
How would you find which kernel path is eating CPU on a host?ToolingSample with a profiler such as perf, look at system versus user time, then trace specific events with eBPF-based tools. Say what you expect to see before you look.
Design and debugging scenarios for experienced candidates. Scroll sideways on a small screen.

Fictional example

Answering "Walk me through a page fault on a memory-mapped file"
Interviewer
A process maps a 1 GB file and reads one byte in the middle of it. What happens, step by step?
Candidate
When the process called mmap, the kernel only recorded a region in its address space pointing at the file; no page table entries exist yet. The load instruction misses in the TLB, the hardware walks the page tables and finds no valid entry, so it raises a page fault. The kernel's fault handler looks up the faulting address, finds the file-backed region, and computes which page of the file that is. It checks the page cache. If another process already read that page, it is a minor fault: the kernel maps the cached page and returns. If not, it allocates a page, asks the file system which block holds that offset, submits the read and puts the thread to sleep. Read-ahead may fetch neighboring pages too. When the interrupt signals completion, the page goes into the cache, the page table entry is filled in, and the faulting instruction is restarted. The second byte on the same page costs nothing extra. I would also mention that if the mapping were private and the process wrote to it, the kernel would copy the page first.

A three-week practice plan for systems OS rounds

  1. Week 1: refresh the base, then go lowerSkim the campus topics once, then read about the system call path, interrupts and the boot sequence of the OS you use most. Write down each sequence as numbered steps.
  2. Week 1: do address arithmetic by handSplit addresses for 4 KiB and 2 MiB pages, estimate effective access time with and without a TLB hit, and check your arithmetic with a few lines of Python.
  3. Week 2: build one small componentWrite a toy allocator, a tiny shell or a user-space thread switcher. You will answer design questions better after you have fought one real bug in one.
  4. Week 2: learn the isolation storyExplain VMs, containers, namespaces, cgroups and sandboxing in your own words, with one sentence on what each does not protect against.
  5. Week 3: rehearse incidentsTake three symptoms (tail latency, a stuck process, memory growth) and practice the order in which you would look, with the tool you would use at each step.
  6. Week 3: mock the deep diveHave a friend keep asking "and then?" until you reach hardware. Note where your chain breaks and study that link.

Neighboring topics come up in the same loops: Linux interview questions for commands and troubleshooting, C interview questions for the coding half of kernel and embedded rounds, multithreading interview questions for application-level concurrency, and the network architect guide if your role spans the network stack.

Deep-dive rounds reward fluent, ordered explanations, which you only get by saying them aloud many times. Natively, an AI interview assistant that runs on your Mac or Windows machine, can transcribe a mock systems interview so you can see where a chain of steps went vague, suggest an answer live when you freeze on a mechanism, and read an address-translation or allocator problem from a screenshot so you can compare its working with your own. If you add your résumé and the job description (Pro or the free trial), suggestions lean toward the systems you have actually built, and transcripts stay in your history for later review.

Questions people ask

What operating systems questions do systems and kernel roles ask?

Expect kernel architecture, the system call and interrupt paths, page table walks and the TLB, allocators, virtualization and containers, OS security features, the I/O stack, and a design question such as a lock or a timer facility.

What is the difference between a monolithic kernel and a microkernel?

A monolithic kernel runs drivers, file systems and networking in one privileged address space, which is fast but less isolated. A microkernel moves those services into user-space processes that exchange messages, which isolates faults at some cost in speed.

How is a container different from a virtual machine?

A virtual machine runs its own kernel on virtualized hardware. A container is a group of processes on the host kernel, isolated with namespaces and limited with cgroups, so it starts faster but shares the host kernel.

How should I prepare for an operating systems deep-dive interview?

Practice explaining mechanisms as ordered steps down to the hardware, do address arithmetic by hand, build one small component such as an allocator, and rehearse how you would debug a few real production symptoms.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP