scx_cosmos

Crates.ioscx_cosmos
lib.rsscx_cosmos
version1.0.2
created_at2025-08-13 17:13:51.361192+00
updated_at2025-09-05 23:12:14.117389+00
descriptionLightweight scheduler optimized for preserving task-to-CPU locality. https://github.com/sched-ext/scx/tree/main
homepage
repository
max_upload_size
id1793864
size126,650
Jake Hillion (JakeHillion)

documentation

README

scx_cosmos

This is a single user-defined scheduler used within sched_ext, which is a Linux kernel feature which enables implementing kernel thread schedulers in BPF and dynamically loading them. Read more about sched_ext.

Overview

Lightweight scheduler optimized for preserving task-to-CPU locality.

When the system is not saturated, the scheduler prioritizes keeping tasks on the same CPU using local DSQs. This not only maintains locality but also reduces locking contention compared to shared DSQs, enabling good scalability across many CPUs.

Under saturation, the scheduler switches to a deadline-based policy and uses a shared DSQ (or per-node DSQs if NUMA optimizations are enabled). This increases task migration across CPUs and boosts the chances for interactive tasks to run promptly over the CPU-intensive ones.

To further improve responsiveness, the scheduler batches and defers CPU wakeups using a timer. This reduces the task enqueue overhead and allows the use of very short time slices (10 us by default).

The scheduler tries to keep tasks running on the same CPU as much as possible when the system is not saturated.

Typical Use Case

General-purpose scheduler: the scheduler should adapt itself both for server workloads or desktop workloads.

Production Ready?

Yes.

Commit count: 0

cargo fmt