Operating Systems
Every topic is a step-by-step animation with the reasoning written beside it — not just what the OS did, but why it decided that.
Start from the beginning →11 topics you can watch now, 17 still to come.
Foundations
What an operating system actually is, and why one exists at all.
Processes
The unit of work an OS schedules, and the states it moves through.
- Context switching
- Threads vs processes
- Inter-process communication
CPU Scheduling
Who gets the CPU next, and what each answer costs you.
- First Come First Served (FCFS)The simplest scheduler there is — and a live demonstration of the convoy effect.
- Shortest Job First (SJF)Provably the best average waiting time, if only you knew the future.
- Shortest Remaining Time First (SRTF)SJF with preemption: a shorter job arriving takes the CPU away.
- Priority SchedulingImportant work first — and the starvation problem that creates.
- Round RobinEveryone gets a turn. The scheduler behind every interactive system you use.
- Multilevel feedback queues
Virtual Memory
What happens when the pages you need do not fit in memory.
- FIFO Page ReplacementEvict the oldest page. Simple, cheap, and occasionally worse when you add memory.
- LRU Page ReplacementEvict whatever has gone unused longest, betting that the recent past predicts the future.
- Optimal Page ReplacementThe unbeatable policy you can never implement — the yardstick for every other one.
- Paging and address translation
- Segmentation
- Thrashing and the working set
Synchronisation
Two processes, one shared variable, and everything that can go wrong.
- Race conditions
- Critical sections and Peterson's solution
- Semaphores
- Producer-consumer
- Readers-writers
- Dining philosophers
Deadlock
The four conditions, and the cost of each way out.
- Coffman conditions
- Resource allocation graphs
- Banker's algorithm
- Detection and recovery
About Operating Systems
An operating system is the program that lies to every other program. It tells each one that it has the whole machine — all the memory, a CPU that never pauses, files that are simply there — and then quietly multiplexes one set of hardware between all of them. Almost everything in this subject is a mechanism for maintaining one of those lies convincingly.
That framing matters because it turns a pile of apparently unrelated topics into one question asked repeatedly. Scheduling is the lie about having a CPU. Virtual memory is the lie about having all the memory. File systems are the lie about persistent, named, contiguous storage. Once you see the pattern, the algorithms stop being arbitrary and start being answers to a specific cost.
It is also the subject where intuition fails most often, which is why every topic here runs as an animation. Convoy effects in first-come-first-served, thrashing under a page-replacement policy, the exact interleaving that produces a deadlock — these are all things you can be told and still not believe until you watch the queue build.
What to know first
- Any one programming language, well enough to know what a variable and a function call cost
- A rough picture of memory as addresses holding bytes
Where it gets used
- Diagnosing why a service slows down under load rather than simply failing
- Reading container and cgroup limits as the resource abstractions they are
- Understanding why a database wants direct control of its own caching