Skills101

Operating Systems · Lesson 9 of 9 · Updated ·

Top Operating System Interview Questions — With Short Answers

Revise these before technical rounds. Each answer fits in two lines — expand with an example if asked.

Process states: new, ready, running, waiting and terminated — the starting point for many OS questions

Basics

  1. What is an OS? Software that manages hardware and provides services to programs: processes, memory, files, devices, security.
  2. Kernel? The core of the OS running in privileged kernel mode.
  3. System call? The way a program requests an OS service (e.g. read, fork).
  4. Monolithic vs microkernel? Monolithic: all services in the kernel (fast, Linux). Microkernel: minimal kernel, services in user space (stable, modular).

Processes and threads

  1. Program vs process? A program is a passive file; a process is a program in execution.
  2. Process vs thread? Processes have separate memory; threads share their process's memory and have their own stacks.
  3. What is a PCB? The Process Control Block — the OS's record of a process (PID, state, registers, memory info).
  4. Context switch? Saving one process's CPU state and loading another's; pure overhead.
  5. Zombie vs orphan? Zombie: finished but not yet reaped by its parent. Orphan: parent died; adopted by init.

Scheduling

  1. Preemptive vs non-preemptive? Preemptive can interrupt a running process; non-preemptive lets it finish its burst.
  2. Which scheduling minimises average waiting time? SJF (non-preemptive) / SRTF (preemptive).
  3. Convoy effect? In FCFS, short jobs wait behind a long one.
  4. Starvation and aging? Starvation: a process waits indefinitely. Aging: gradually raising its priority.

Synchronization and deadlock

  1. Race condition? The output depends on the timing of concurrent access to shared data.
  2. Mutex vs semaphore? Mutex: a lock with an owner. Semaphore: a counter with wait/signal; can manage n resources.
  3. Deadlock conditions? Mutual exclusion, hold and wait, no preemption, circular wait — all four.
  4. Deadlock vs starvation? Deadlock: processes wait for each other forever. Starvation: one process waits while others progress.
  5. Banker's algorithm? Deadlock avoidance — grant a request only if the system stays in a safe state.

Memory

  1. Paging vs segmentation? Paging: fixed-size pages (no external fragmentation). Segmentation: variable-size logical segments.
  2. Internal vs external fragmentation? Internal: waste inside an allocated block. External: free memory split into unusable holes.
  3. What is a TLB? A fast cache of page-table entries that speeds up address translation.
  4. Virtual memory? Using disk to extend RAM; only needed pages stay in memory (demand paging).
  5. Page fault? Accessing a page that isn't in RAM; the OS loads it from disk.
  6. Thrashing? Excessive paging that leaves the CPU idle; fix by reducing multiprogramming or adding frames.
  7. Belady's anomaly? With FIFO replacement, more frames can cause more page faults.

Bonus: quick calculations interviewers like

  • n calls to fork() → 2ⁿ processes in total.
  • Page number / offset: page = address ÷ page size, offset = address mod page size.
  • Waiting time = turnaround − burst; turnaround = completion − arrival.

Common mistakes

  • Mixing up deadlock prevention (break a condition) and avoidance (stay safe).
  • Saying threads have separate heaps.
  • Forgetting that all four deadlock conditions are needed together.

Quick recap

  • Revise: kernel, process vs thread, PCB, scheduling, race conditions, mutex vs semaphore, deadlock, paging, virtual memory, thrashing.
  • Answer in two lines, then give an example.

Practice what you learned

📝 Quiz: OS Interview Questions5 questions · instant answers & explanations · +10 XP · counts towards your free certificateTake the quiz →