OS Fundamentals

35 lessons

Understand operating systems from first principles. Processes, memory management, scheduling, filesystems, and concurrency — and why your algorithms and data structures knowledge actually matters here. Hands-on with real Linux tools.

what you'll learn

  • Processes and execution — fork, exec, process states, and what the kernel manages
  • CPU scheduling — round-robin, CFS, priority inversion, and real-time scheduling
  • Virtual memory — page tables, TLB, demand paging, and why mmap works
  • Filesystems — inodes, directories, journaling, and how ext4 organizes disk
  • Concurrency — threads, mutexes, semaphores, deadlocks, and race conditions
  • Hands-on Linux tools — /proc, strace, top, and observing the OS in action

Processes & Execution

Introduction

What is an operating system, why does it exist, and what does the kernel actually do? The illusion of private machines, system calls, and what this book covers.

What Is a Process?

The fundamental abstraction that lets multiple programs share one CPU. Understand process memory layout, the illusion of isolation, and why a 'running program' is more complex than it sounds.

fork(), exec(), and Process Creation

How processes are born. The elegant Unix model of fork-then-exec, copy-on-write optimization, and why creating a process is actually duplicating one.

Process States & Lifecycle

Running, sleeping, zombie, orphan—processes have a lifecycle. Understand state transitions, what the scheduler sees, and how to diagnose stuck processes.

Threads vs Processes

Shared memory vs isolation. When to use threads, when to use processes, and how Linux blurs the line with clone(). The data structures that track both.

CPU Scheduling

The Scheduling Problem

One CPU, many processes. The scheduler decides who runs, for how long, and in what order. Understand why this is fundamentally a data structures problem.

Scheduling Algorithms

FCFS, Round Robin, Priority Queues, MLFQ. Classic algorithms and their trade-offs. Why O(1) scheduling was revolutionary and why CFS replaced it.

Linux's Completely Fair Scheduler

CFS in depth: red-black trees for O(log n) scheduling, virtual runtime, and how Linux achieves fairness. See the data structure that runs your computer.

Context Switching

The mechanics of switching between processes. What gets saved, what gets restored, and why context switches are expensive. Measuring switch overhead.

Memory Management

The Virtual Memory Illusion

Every process thinks it has the entire address space to itself. How the OS creates this illusion, why it matters, and what happens when you dereference a pointer.

Page Tables & Address Translation

The data structure that maps virtual to physical addresses. Multi-level page tables, why they're trees, and the space-time trade-off they embody.

Demand Paging & Page Faults

Memory isn't allocated until it's used. Page faults, lazy allocation, and how the OS handles 'missing' pages. The performance implications of page fault storms.

Page Replacement Algorithms

When RAM is full, something must go. LRU, Clock, and the algorithms that decide which pages get evicted. Why optimal replacement is impossible in practice.

Memory Allocators: Inside malloc()

What happens when you malloc(100)? Free lists, buddy allocators, slab allocation. The data structures that make dynamic memory possible.

Concurrency & Synchronization

Concurrency & Race Conditions

When multiple threads access shared data, order matters. Race conditions, data races, and why concurrent programming is fundamentally hard.

Mutexes & Critical Sections

Mutual exclusion: ensuring only one thread accesses shared data at a time. How mutexes work, the cost of locking, and when to use them.

Semaphores & Condition Variables

Beyond mutexes: coordinating thread execution order. Counting semaphores, condition variables, and the producer-consumer pattern.

Lock-Free Data Structures

Concurrency without locks. Compare-and-swap, atomic operations, and the data structures that power high-performance concurrent systems.

File Systems

Files & File Descriptors

Everything is a file—but what is a file? File descriptors, the file table, and the abstraction that unifies devices, sockets, and storage.

Inodes & Directory Structure

How files are stored on disk. Inodes, directory entries, hard links vs soft links. The tree structure that organizes your filesystem.

Journaling & Crash Recovery

What happens when power fails mid-write? Journaling filesystems, write-ahead logging, and how databases and filesystems stay consistent.

The Virtual Filesystem (VFS)

How Linux supports dozens of filesystems with one interface. The VFS abstraction layer, inode caching, and dentry caches.

I/O & Storage

Block Devices & Drivers

How the OS talks to storage hardware. Block devices, device drivers, and the interface between kernel and hardware.

I/O Scheduling

Ordering disk requests for performance. Elevator algorithms, CFQ, deadline scheduler, and why SSDs changed everything.

Buffering & Caching

The page cache, buffer cache, and why your writes don't hit disk immediately. Understanding sync, fsync, and durability guarantees.

Virtualization & Containers

Virtualization Fundamentals

Running an OS inside an OS. Hypervisors, hardware virtualization, and the illusion of having your own machine.

Linux Namespaces

Isolation without virtualization. PID namespaces, mount namespaces, network namespaces—the building blocks of containers.

Control Groups (cgroups)

Resource limits for processes. CPU limits, memory limits, I/O bandwidth—how the kernel enforces fair sharing.