Roadmaps / Fundamentals / Phase 2
Phase 2 of 4 · Study weeks 5-8
The operating system
This phase makes the second checkpoint possible: a server that stores data durably and where you can say what it asks of the kernel.
Topics every week
- Week 58 h
- Processes and threads
- System calls and their cost
- Virtual memory and page faults
- File descriptors and limits
Hand inA system call trace of the server and a count per message
- Week 68 h
- The file system and the page cache
write,fsyncand what they promise- Short writes and errors
- Atomic renames
Hand inThe append log with a flush policy and a test for a short write
- Week 78 h
- I/O models: blocking, non-blocking,
epollandio_uring - Scheduling and context switches
- CPU and memory limits in containers
Hand inA note comparing the I/O models with one measurement each
- I/O models: blocking, non-blocking,
- Week 88 h
- Observing a running process:
strace,perf,/proc,iostat - Crash tests with
kill -9 - Predicted against measured
Hand inCheckpoint 2: the three-policy table and the 20-kill table
- Observing a running process:
Practice projects
- Practice 1, the syscall count (Week 5): trace the server for 10,000 messages. Done when: you list the five most frequent system calls and the count per message.
- Practice 2, the short write (Week 6): make the file system return fewer bytes than asked, with a test double. Done when: the log stays correct, and a test fails without your fix.
- Practice 3, the crash (Week 8): kill the process in the middle of a batch, 20 times. Done when: every acknowledged message is present after restart and the table shows the result.
- Optional, the I/O models: serve 1,000 connections with threads, then with
epollor the language's event loop. Done when: a table shows memory and latency for each.
GitHub repos to study
Existence and last commit were checked on 22 Nov 2026 by shallow clone. Every repository below had a commit in the last 12 months.
| Repo | What to read | Week |
|---|---|---|
| torvalds/linux | fs/read_write.c and the epoll implementation | 6 |
| axboe/liburing | The io_uring examples and the man pages | 7 |
| iovisor/bcc | Tools such as biolatency and opensnoop and how they work | 8 |
| opencontainers/runc | How cgroups and namespaces limit a process | 7 |
Milestone checkpoint
Build Checkpoint 2. Write the kill script and your throughput predictions first. Add the log, the three flush policies and the short-write test. Run the 20 kills for each policy and fill the table. Hand in the traces, the table, ADR-3 (the acknowledgement rule) and ADR-4 (the I/O model).
Check yourself
Answer each question in your head first, then open it to check.
What does
writereturn, and what does it not guarantee?It returns the number of bytes accepted, which can be fewer than asked. The data is in the operating system buffer, not on the disk.What does
fsyncguarantee, and what can still be lost?The data and metadata of that file are flushed to the device. A new file's directory entry needs its own sync, and a device that lies about flushing can still lose data.Why do system calls cost more than function calls?
They cross into the kernel, which switches privilege level and may flush caches. Batching calls shares that fixed cost.What is a page fault, and when is it expensive?
A page fault happens when a process touches memory that is not mapped yet. It is cheap if the page is in memory, and expensive if the kernel must read it from disk.When would you choose
epollover threads?When you have many mostly idle connections, so a thread each would use too much memory and too many context switches.