Operating Systems Workbook

44 topics across foundations, non-functional requirements, building blocks, full system designs, and public postmortems. Every system uses the same 7-step interview walk-through; every building block has a consistent design template.

14 Foundational 23 Intermediate 7 Advanced 6 topics RSS

Foundations

4 items

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

  • 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

Processes, the API to create them, context switching, and the scheduling policies that decide who runs next.

  • The Process Abstraction

    Process state (running / ready / blocked), address space, PCB, and the kernel's view of a running program.

    Concept Foundational
  • Process API — fork, exec, wait

    The UNIX trio that creates and controls processes. Why fork+exec is the standard idiom and what dup/pipe add on top.

    Building Block Foundational
  • Context Switching

    Saving and restoring CPU state across processes — register sets, kernel stack, the cost paid every preemption.

    Building Block Intermediate
  • CPU Scheduling — FIFO, SJF, STCF, RR

    Four classic scheduling disciplines, their turnaround / response-time trade-offs, and where each breaks down.

    Building Block Foundational
  • Multi-Level Feedback Queue (MLFQ)

    Adaptive priority queues, priority boosts to prevent starvation, accounting tricks to defeat gaming.

    Building Block Intermediate
  • Lottery Scheduling and Linux CFS

    Probabilistic fair-share scheduling, ticket mechanisms, and how CFS uses red-black trees for O(log n) operations.

    Building Block Intermediate
  • Multi-CPU Scheduling

    Cache affinity, single-queue vs per-CPU queues, load balancing, and why scaling beyond one core is hard.

    Concept Advanced

Address spaces, the path from virtual to physical address, page tables, TLBs, swapping, and what a real production VM stack looks like.

  • Address Spaces

    Code / heap / stack layout, why each process gets its own view, and the three goals (transparency, efficiency, protection).

    Concept Foundational
  • Memory API — malloc, free, and friends

    Heap allocation in user space, common errors (use-after-free, double-free, leaks), and how the allocator talks to the OS via brk / mmap.

    Building Block Foundational
  • Address Translation — Base and Bounds

    The simplest hardware mechanism for memory virtualization — relocation registers, bounds checks, OS responsibilities.

    Building Block Intermediate
  • Segmentation

    Generalised base/bounds per code/heap/stack segment, sharing across processes, fragmentation as the recurring cost.

    Building Block Intermediate
  • Free Space Management

    Allocator strategies — first-fit, best-fit, worst-fit, next-fit, segregated free lists, buddy, slab — and what fragmentation actually costs.

    Building Block Intermediate
  • Paging Fundamentals

    Fixed-size pages, page tables, valid / present / protection bits, and the cost paid on every memory access without a cache.

    Building Block Intermediate
  • Translation Lookaside Buffers (TLBs)

    The cache that makes paging fast. Miss handling (HW vs SW), context-switch invalidation, ASIDs, and a real TLB entry's bits.

    Building Block Intermediate
  • Multi-Level Page Tables

    Sparse address spaces, x86_64's 4-level walk, the time-space trade-off, inverted page tables, hashed alternatives.

    Building Block Advanced
  • Swapping — Mechanisms

    Swap space, the present bit, page fault control flow, copy-on-write, prefetching, and when replacements actually happen.

    Building Block Intermediate
  • Page Replacement Policies — OPT, FIFO, LRU, CLOCK

    The classic algorithms, why OPT is unachievable, how CLOCK approximates LRU cheaply, and the thrashing wall.

    Building Block Intermediate
  • Linux Virtual Memory System

    The Linux address space layout, four-level page tables, page cache, huge pages, KASLR — what a real production VM stack looks like.

    System Advanced

Concurrency

8 items

Threads, the synchronization primitives (locks, condition variables, semaphores), and the bugs that come with shared state.

  • Threads and Shared State

    Why threads, the heart of the problem (uncontrolled scheduling), atomicity, and the wish that motivates every primitive.

    Concept Foundational
  • POSIX Threads API

    pthread_create / join / mutex / cond — the canonical thread surface and the gotchas around using it correctly.

    Building Block Foundational
  • Locks and Spinlocks

    Test-and-set, compare-and-swap, fetch-and-add, two-phase locks, and why a spinlock is rarely the right answer in user space.

    Building Block Intermediate
  • Concurrent Data Structures

    Concurrent counters, linked lists, queues, and hash tables — coarse-grained vs hand-over-hand vs lock-free, and where each one breaks under contention.

    Building Block Intermediate
  • Condition Variables

    Wait / signal / broadcast, the always-use-while rule, the producer-consumer pattern, covering conditions.

    Building Block Intermediate
  • Semaphores

    Counting semaphores as a generalisation of locks; binary semaphores; ordering; readers-writers; dining philosophers.

    Building Block Intermediate
  • Concurrency Bugs — Deadlock, Atomicity, Order

    Non-deadlock vs deadlock bugs; the four conditions for deadlock; prevention, avoidance, detection-and-recovery.

    Concept Intermediate
  • Event-Based Concurrency

    Event loops, select / poll / epoll, async I/O, the manual state-management cost, and why JS, Nginx, and Node landed here.

    Building Block Advanced

Persistence

11 items

I/O devices, hard drives, RAID, the UNIX file system interface, file-system implementation, FFS, journaling, LFS, SSDs.

  • I/O Devices and Drivers

    The canonical device protocol, interrupts vs polling, DMA, memory-mapped I/O, and the driver as an OS abstraction.

    Building Block Foundational
  • Hard Disk Drives

    Geometry, seek + rotational latency + transfer time, disk scheduling (SSTF, SCAN, C-SCAN), and the I/O-cost math.

    Building Block Foundational
  • RAID — Striping, Mirroring, Parity

    RAID 0/1/4/5/6 — capacity, performance, reliability trade-offs and where parity-based schemes break down.

    Building Block Intermediate
  • Files and Directories

    The UNIX file abstraction, descriptors, inodes, hard vs symbolic links, fsync, mount, and the permission-bit model.

    Building Block Foundational
  • File System Implementation

    Inode + data-block layout, free-space tracking, directory structures, access paths, caching, and the I/O cost per system call.

    Building Block Intermediate
  • The Fast File System (FFS)

    Cylinder groups, locality policy, large-file exception — the design that made UNIX file systems orders of magnitude faster.

    System Intermediate
  • Crash Consistency — fsck and Journaling

    Write-ahead logging, metadata-only vs full journaling, ordered mode, soft updates, and why fsck stopped scaling.

    Building Block Intermediate
  • Log-Structured File System (LFS)

    Sequential writes, segments, inode maps, garbage collection — the design that influenced flash file systems and modern databases.

    System Advanced
  • Flash SSDs and the Flash Translation Layer

    Cells, banks, planes; erase-before-write; the FTL log-structured mapping; garbage collection; wear leveling; trim.

    Building Block Advanced
  • Data Integrity — Checksums and Scrubbing

    Latent sector errors, silent corruption, checksums, mismatched-write protection, periodic scrubbing — bit-rot defense.

    Building Block Intermediate
  • GitLab 2017 — The Database Outage

    How a 'wrong terminal' rm on a primary led to ~6 hours of data loss; backups that didn't work; the public postmortem.

    Postmortem Foundational

Distribution

3 items

Going across machines — communication basics, RPC, and distributed file systems (NFS, AFS).

Search ESC

Keyboard shortcuts

Shortcuts are disabled while typing in inputs.