⚙️ Placement

OS Interview Basics — Process vs Thread, Deadlock, Paging

📅 Jul 2, 2026 ⏱ 4 min read

OS rounds recycle the same handful of concepts. Plain-words versions below — interviewers prefer them to recited definitions.

Process vs thread (asked EVERY time)

A process is a running program with its own memory space. Threads are execution lanes inside a process sharing that memory. Sharing makes threads cheap to create and fast to communicate — and gives them race conditions, which is why locks exist. Chrome: each tab ≈ a process (one crash doesn't kill the browser); within a tab, threads render and run JS.

Deadlock — the 4 conditions (all must hold)

  1. Mutual exclusion — resource used by one at a time
  2. Hold and wait — holding one, wanting another
  3. No preemption — can't snatch resources back
  4. Circular wait — A waits on B waits on A

Break any one to prevent deadlock — e.g., ordered lock acquisition kills circular wait.

Virtual memory + paging

Each process believes it has huge contiguous memory; the OS maps fixed-size pages to scattered physical frames. Rarely-used pages swap to disk. Benefit: isolation + more "memory" than RAM. Thrashing = too much swapping, everything crawls.

Scheduling in one breath

FCFS (simple, convoy problem) · SJF (optimal average wait, needs future knowledge) · Round Robin (time slices — interactive systems) · Priority (starvation risk → aging fixes it).

← All Articles