Agile Development of Linux Schedulers with Ekiben

Samantha Miller, Anirudh Kumar, Tanay Vakharia, Tom Anderson, Ang Chen, Danyang ZhuoarXiv 2023 · DOI

Abstract

Developing Linux kernel schedulers is traditionally a slow and error-prone process due to the monolithic nature of the kernel and the lack of safety guarantees in C. Ekiben is a new framework that introduces "agile" development to the Linux scheduler by leveraging safe Rust. It enables high-velocity iteration through features like live upgrades—swapping schedulers in approximately 10 microseconds—and userspace record-and-replay debugging. Evaluation shows that Ekiben maintains performance within 1% of the default Linux Completely Fair Scheduler (CFS) while significantly improving developer productivity.

Introduction

The Linux kernel scheduler acts as the "brain" of the operating system, managing task allocation across CPU cores. However, modifying this core component is notoriously difficult. A single bug, such as a null pointer dereference, can crash the entire system. Furthermore, the development cycle is hindered by the need to recompile the kernel and reboot the machine to test every change.

Existing alternatives like "kernel bypass" or userspace scheduling frameworks (e.g., Google’s ghOSt) often introduce significant latency or struggle with efficient resource sharing. Ekiben seeks a middle ground: providing the safety and speed of modern development tools with the performance of in-kernel execution.

System Architecture

Ekiben splits the scheduling architecture into two distinct layers to balance safety and performance.

The Ekiben architecture showing the interaction between the kernel, the C-based interface, and the Rust-based scheduler module.
  1. Ekiben-C: A minimal, stable C component integrated into the Linux kernel. It handles low-level mechanics like context switching and direct interaction with the task_struct.
  2. libEkiben & Scheduler Module: A pluggable module written in safe Rust. This layer contains the actual scheduling logic.

To ensure safety, Ekiben utilizes Rust’s ownership model through a custom Schedulable type. When the kernel requests a task, it passes a Schedulable object to the scheduler. The scheduler must return this object as "proof" of ownership before the task can run. This compile-time check prevents common errors, such as running a task on an invalid core or accessing a task that has already terminated.

Implementation and Safety

A key goal of Ekiben is to minimize the amount of unsafe code required to implement complex scheduling policies. By isolating the unsafe low-level operations in Ekiben-C, the majority of the scheduler logic can be written in safe Rust.

Breakdown of lines of code (LOC) and unsafe LOC across Ekiben components.

As shown in the implementation data, the core scheduler logic (Scheduler libEkiben) contains very few unsafe lines of code compared to its total size. This isolation allows developers to focus on policy logic without the constant risk of system-wide crashes.

Key Innovations

Live Upgrades

Ekiben supports live upgrades using a per-scheduler read-write lock. The system can "quiesce" (pause) an active scheduler, transfer its state (such as task runtimes) to a new version, and resume execution. This process typically takes between 1.5 and 10.1 microseconds, making the transition virtually invisible to running applications.

Record and Replay

For debugging, Ekiben can log interactions between the kernel and the scheduler. These logs can be replayed in userspace, allowing developers to use standard tools like gdb to diagnose logic errors without needing a live kernel environment.

Evaluation and Results

The authors evaluated Ekiben using microbenchmarks (perf, schbench) and real-world application suites (NAS Parallel Benchmarks, Phoronix Multi-core Test Suite).

  • Performance: A Weighted Fair Queuing (WFQ) scheduler implemented in Ekiben achieved performance within 1% of the default Linux CFS.
  • Latency: Ekiben adds only 0.4–0.6 microseconds of overhead per scheduling decision compared to CFS, significantly outperforming asynchronous userspace frameworks.
  • Accessibility: The framework's ease of use was demonstrated by undergraduates with no prior kernel experience, who successfully implemented specialized schedulers like Shinjuku and a locality-aware arbiter.

Conclusion

Ekiben demonstrates that Rust’s type system can enforce logical kernel invariants at compile time, transforming kernel development from a "nightmare" into a modern, agile workflow. While the system currently trusts the scheduler not to enter infinite loops, it provides a robust foundation for future exploration in multi-level scheduling and safer operating system design.

Summary updated

BibTeX
@misc{miller2023agile,
  author = {Samantha Miller and Anirudh Kumar and Tanay Vakharia and Tom Anderson and Ang Chen and Danyang Zhuo},
  title = {{Agile Development of Linux Schedulers with Ekiben}},
  year = {2023},
  eprint = {2306.15076},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.15076},
}
Figure