User-Space Switch: Minimal State, No Kernel
User-space schedulers achieve nanosecond context switches by avoiding costly kernel calls and saving only essential, process-local state directly within the application runtime, exemplified by Erlang's BEAM.
The top 3
- User-Space Switch: CPU Registers vs. Full Context: User-space context switching primarily saves and restores only the CPU's general-purpose registers, program counter, and stack pointers, a significantly smaller state than the full process memory maps and privilege levels handled by kernel context switches.
- Kernel Bypass: Avoiding TLB Flushes & Privilege Changes: By performing context switches entirely in user-space, processes avoid costly kernel operations such as flushing the Translation Lookaside Buffer (TLB) and the overhead of transitioning between user and kernel CPU privilege modes.
- User-Space Switch: Predictable Latency, No OS Jitters: Bypassing the kernel scheduler eliminates unpredictable delays stemming from operating system decisions or system calls, resulting in more consistent and lower-latency context switches crucial for highly responsive and high-throughput applications.
Sources
Open the full topic