Expert · Module 10
User-Space Runtimes, Fiber Execution, and Coroutine Schedulers
Master manual stack switching, ABI register conventions, custom fiber runtimes, cooperative schedulers, and M:N work-stealing execution engines in C.
Operating system threads (pthreads) carry significant kernel scheduling overhead, 8 MB default stack allocations, and frequent context-switch penalties across privilege boundaries (Ring 3 to Ring 0). High-concurrency systems—from Go's runtime to high-throughput financial matching engines—bypass the kernel scheduler entirely by multiplexing millions of lightweight user-space execution contexts (fibers/coroutines) over a small pool of CPU cores.
In this expert tier, you step below compiler abstractions to manipulate CPU execution state directly. You will allocate isolated hardware stacks in virtual memory, audit the System V AMD64 register preservation contract, write x86-64 assembly routines to pivot the stack pointer (%rsp), construct cooperative state machines, and engineer a full M:N work-stealing coroutine runtime in pure C.
- 1Hardware Stack Architecture, Stack Frames, and the System V AMD64 ABIPro — members onlyDissect execution stack frames on x86-64, navigate the System V AMD64 ABI calling convention, inspect caller vs. callee-saved registers, and enforce 16-byte stack alignment.16 min
- 2Stack Allocation, Alignment, and Guard Pages with mmap and mprotectPro — members onlyAllocate page-aligned fiber stacks with mmap, enforce hardware-level overflow traps using mprotect guard pages, calculate initial 16-byte aligned stack pointers, and build recycled stack pools.16 min
- 3Historical & Standard Primitives: setjmp/longjmp, sigaltstack, and ucontext_tPro — members onlyExamine POSIX context-switching mechanisms, diagnose why setjmp cannot safely switch stacks, benchmark the hidden syscall cost of ucontext_t, and handle stack overflows via sigaltstack.16 min
- 4Manual Assembly Context Switching: Callee-Saved Registers and Stack PivotsPro — members onlyImplement sub-5-nanosecond x86-64 user-space context switches in pure assembly, manipulate stack pivots, and seed initial stack frames for new fibers.16 min
- 5Coroutine Lifecycles, Trampolines, and State MachinesPro — members onlyEngineer a complete cooperative coroutine lifecycle engine in C, manage state transitions, handle clean termination via entry trampolines, and prevent self-referential use-after-free bugs.16 min
- 6Asynchronous Event Integration: Cooperative I/O with epoll and timerfdPro — members onlyIntegrate Linux epoll and timerfd into a cooperative coroutine scheduler, transform blocking network and sleep calls into non-blocking yields, and achieve synchronous-style asynchronous I/O.16 min
- 7Cooperative Synchronization: Fiber Mutexes, Semaphores, and ChannelsPro — members onlyConstruct user-space synchronization primitives without kernel locks, engineer wait-queue fiber mutexes, implement counting semaphores, and design CSP channels with backpressure.16 min
- 8Multi-Threaded M:N Schedulers: Work-Stealing Queues and Thread-Local WorkersPro — members onlyScale coroutine execution across all CPU cores using M:N work-stealing scheduling, lock-free Chase-Lev deques with C11 atomics, and cache-aligned worker runqueues.16 min
- 9Project: High-Performance Cooperative Coroutine Runtime and SchedulerPro — members onlySynthesize mmap guard-paged stacks, x86-64 assembly context pivots, epoll I/O multiplexing, timerfd sleep queues, and CSP channels into an integrated coroutine runtime in C.25 min
- 10Dynamic Loading, ELF Relocations, and Plugin ABIsPro — members onlyLoad shared objects at runtime, resolve symbols safely, and design plugin boundaries that survive independent compilation and deployment.18 min
- 11FUSE Filesystem Architecture and ImplementationPro — members onlyBuild a user-space filesystem model and reason about FUSE request lifetimes, caching, permissions, and consistency.18 min
- 12Device Files, ioctl, sysfs, and procfs InterfacesPro — members onlyUnderstand how user-space programs communicate with kernel and device subsystems through special files, ioctl contracts, and virtual filesystems.18 min