← All system designs

Foundations

What an OS is, what it's for, and the mechanisms (user/kernel mode, limited direct execution) that make it possible. Read these first.

4 items 3 Foundational 1 Intermediate

An operating system has three jobs: virtualize hardware, manage concurrency, and persist state. Every topic in this workbook is a deep dive on one of those jobs, and the Foundations topic is the orientation — what an OS actually does, why the design choices are what they are, and the small set of hardware mechanisms (privilege levels, traps, timer interrupts) that make a modern OS possible at all.

For interview prep, internalise the three-jobs framing. It's the answer to 'why do operating systems exist?' and the structure most reasonable interviewers will let you build a discussion on.

Key concepts

  • An OS virtualizes the CPU, memory, and I/O so each process gets a clean abstraction
  • It manages concurrency — threads, locks, atomicity — because shared state breaks naive code
  • It persists state through file systems and storage stacks that survive crashes and corruption
  • Hardware support (mode bits, traps, MMU, timer) is what makes all of the above tractable
  • Most design questions resolve as a trade-off between safety, performance, and complexity

Reference template

// Mental model for any OS topic
1. What's the abstraction?    (what does the user see?)
2. What's the mechanism?      (what does the hardware/OS do?)
3. What's the policy?         (when there's a choice, what drives it?)
4. What's the overhead?       (latency, memory, CPU cost)
5. What's the failure mode?   (what goes wrong and how is it recovered?)

Adapt to your problem; the structure is the load-bearing part.

Common pitfalls

  • Confusing mechanism with policy — paging is a mechanism, LRU is a policy
  • Treating 'user space' and 'kernel space' as buzzwords rather than a privilege boundary
  • Forgetting that almost every OS feature exists to virtualize something the hardware does only one of
  • Skipping the history — every modern design has a predecessor whose failure motivated it

Related topics

Items (4)

  • What Is an Operating System?

    The three jobs of an OS — virtualize hardware, manage concurrency, persist state — and why each one matters.

    Concept Foundational
  • OS Design Goals

    Abstractions, low overhead, protection and isolation, reliability. The criteria every kernel decision is weighed against.

    Concept Foundational
  • User Mode vs Kernel Mode

    Hardware privilege levels, system calls, trap-and-emulate, and the cost of crossing the boundary.

    Concept Foundational
  • Limited Direct Execution

    How the CPU runs user code at full speed while the OS still keeps control — traps, trampolines, timer interrupts.

    Concept Intermediate
Search ESC

Keyboard shortcuts

Shortcuts are disabled while typing in inputs.