Operating Systems Through the Go Runtime
A mini course that teaches operating systems concepts through the Go runtime.
Why the Go Runtime?
The Go runtime is essentially a user-space operating system. It:
- Schedules thousands of goroutines onto a small number of OS threads
- Manages memory with its own allocator and garbage collector
- Multiplexes I/O using epoll/kqueue so blocking calls don’t block threads
- Handles signals for preemption and OS integration
- Manages stacks that grow and shrink dynamically
All of this is written in readable Go (with some assembly for the lowest-level operations), making it far more approachable than a kernel like Linux while covering the same fundamental concepts.
Course Structure
| Module | Topic | Duration |
|---|---|---|
| 1 | Introduction: The Runtime as an OS | 45 min |
| 3 | Processes, Threads, and Goroutines | 60 min |
| 4 | The Go Scheduler | 75 min |
| 5 | Work Stealing and Preemption | 60 min |
| 6 | Synchronization Primitives | 60 min |
| 7 | Channels and Select | 60 min |
| 10 | File Systems, I/O, and the Network Poller | 60 min |
Optional Modules
| Module | Topic | Duration |
|---|---|---|
| 2 | System Calls | 60 min |
| 8 | Memory Management | 60 min |
| 9 | Goroutine Stacks | 45 min |
Materials
Each module includes:
- Lecture notes — Detailed reading material with Go runtime code walkthroughs
- Comprehension checks — Short questions to verify understanding
Additional resources:
- Programming Assignments — Three hands-on projects
- Final Exam — Comprehensive assessment
- Glossary — Key terms defined
- Code Walkthrough — Trace a goroutine’s full lifecycle
- Experiments — Hands-on runtime exploration
- Further Reading — Books, papers, and resources
Getting Started
- Read the syllabus for the full course overview and learning outcomes
- Clone the Go source tree to follow along with code references
- Start with Module 1
All code references use the format file.go:line and point to files under
src/runtime/ in the Go source tree unless otherwise noted.