Operating Systems
Learn operating systems with interactive CPU scheduling and page replacement simulators, process-state animations, written lessons and quizzes.
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)Simulate FCFS CPU scheduling with your own arrival and burst times. Follow the Gantt chart, calculate waiting and turnaround times, and see the convoy effect.
- Shortest Job First (SJF)Explore non-preemptive SJF CPU scheduling with your own processes. Follow the Gantt chart and compare waiting and turnaround times step by step.
- Shortest Remaining Time First (SRTF)Simulate preemptive SRTF CPU scheduling. Enter arrival and burst times, see when shorter jobs interrupt, and follow the Gantt chart and waiting times.
- Priority SchedulingRun priority CPU scheduling with your own processes and priorities. Follow the Gantt chart, waiting times and an explanation of starvation and ageing.
- Round Robin CPU SchedulingSimulate Round Robin CPU scheduling with your own processes and time quantum. Follow the Gantt chart and calculate waiting, turnaround and response times.
- Multilevel feedback queues
Virtual Memory
What happens when the pages you need do not fit in memory.
- FIFO Page ReplacementSimulate FIFO page replacement with your own reference string and frame count. Track page faults and see why more frames can cause Belady's anomaly.
- LRU Page ReplacementSimulate LRU page replacement with your own reference string and memory frames. Track hits, page faults and how the least recently used page is selected.
- Optimal Page ReplacementExplore optimal page replacement with your own reference string. See future-use decisions and page faults, and learn why this policy is a benchmark.
- 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