Runtime scheduling: theory and reality
summary
Compares the Linux kernel CFS, Go's M/P/G runtime and Erlang's BEAM with concrete measurements: a pipe ping‑pong benchmark via perf bench sked_pipe shows ~4.5 µs per op (≈2.25 µs per context switch) which falls to ~1 µs after core pinning; a Go channel ping‑pong measures ~2 µs switches; Erlang uses a reduction budget 2000 to force sub‑millisecond preemption. Uses ftrace and perf sched to inspect behavior. Conclusion: Go trades predictability for throughput; Erlang trades throughput for tight, predictable latency.
AI-written summary · about
chapters (16)
- 0:00Start
- 1:58User Space Schedulers
- 2:35Scheduling in Kernel-Space
- 3:10The Duration of a Context Switch
- 3:45Estimating the Intrinsic Direct Cost of a Context Switch
- 8:31Active Benchmarking
- 10:09Internals of the Linux Kernel Scheduler
- 11:39Design Principles
- 14:37Interrupt Handler
- 19:20Scheduling in Userspace
- 22:21The Go Scheduler
- 25:21Erlang
- 27:28Implications of this Design
- 27:54Consequences
- 33:10The Distinction between Context Switching between Native Threads and between Green Threads
- 35:51Cache Utilization
related talks
47mQueues, Fairness, and The Go Scheduler
22mTales of Go Runtime Scheduler
02h 08mTutorial: Leveraging the OS CPU Scheduler to Write Real-Time MT Apps
51mFrom Linux Threads To ForkJoinPool
43mConcurrency Oriented Programming in a Modern World
54mIntroduction to Realtime Linux
29mConcurrency and Parallelism From The Ground Up
48m“Is Parallel Programming still hard? PART 2 of 2”
