The Problem
Linux kernel schedulers must expose a deterministic priority model, yet many workloads benefit from domain‑specific weighting (e.g., interactive shells vs. batch compilers). The default CFS algorithm provides only generic fairness, requiring operators to tune manually.
What This Does
scx_horoscope implements a sched_ext scheduler that derives per‑task priorities from real‑time planetary positions, zodiac signs, and elemental affinities. Core logic lives in src/astrology/ – planets.rs supplies planetary data, scheduler.rs computes influence factors, and tasks.rs classifies Linux tasks by zodiac sign. The BPF interface (src/bpf.rs, src/bpf_intf.rs, src/bpf_skel.rs) marshals these decisions to the kernel. The entry point is src/main.rs::run (line 200), which orchestrates initialization, task dispatch, and status reporting.
How It Is Wired
Execution starts in src/main.rs::run. It calls:
init(src/main.rs:72) → creates aSchedulerviasrc/astrology/scheduler.rs::new.dispatch_tasks(src/main.rs:107) → iterates over tasks, invokingschedule_task(insrc/astrology/tasks.rs) for each.schedule_taskcallscalculate_planetary_positions(insrc/astrology/planets.rs) which in turn callsfrom_longitude(7×) andis_retrograde(5×) to detect retrograde motion.- The planetary result feeds
calculate_element_boost(src/astrology/scheduler.rs) andcalculate_planetary_influence. Both return multipliers that are multiplied into the base priority defined insrc/astrology/tasks.rs::ruling_planet. - The final priority is handed to the BPF layer via
src/bpf.rs::to_queued_task, which writes the struct into the kernel’s sched_ext queue.
The internal call graph contains 55 resolved edges; the most widely used functions are calculate_planetary_positions (5 callers) and schedule_task (4 callers). No circular imports were detected. The BPF C file main.bpf.c (633 lines) is the only non‑Rust component; it implements the low‑level kernel hook but does not call back into Rust code.
How To Use It
# Clone the repository
git clone https://github.com/moses-y/scx_horoscope
cd scx_horoscope
# Build the scheduler and BPF skeleton
cargo build --release
The built binary (target/release/scx_horoscope) must be executed as root because it loads the BPF program into the kernel:
sudo ./target/release/scx_horoscope
No additional configuration files are present; all parameters (e.g., base priorities, element multipliers) are hard‑coded in the Rust source (scheduler.rs, tasks.rs). To adjust them, edit the corresponding constants and rebuild.
Real‑World Use
A DevOps team running a high‑throughput CI system can replace the default scheduler with scx_horoscope to give compilation jobs (Mars‑ruled, fire sign) a 1.5× CPU boost during favorable planetary phases, while interactive shells (Moon‑ruled) receive a moon‑phase‑based slice increase. The team would load the scheduler at boot via a systemd unit that runs the built binary with sudo.
Code Health & Issues
- High – No LICENSE – repository root lacks a licence file; default is “all rights reserved”.
- High – No test suite – 10 source files, zero test files; changes have no regression guard.
- High – No CI workflow – no
.github/workflowsor other CI config; builds are not automatically verified. - Medium – Deep nesting –
src/main.rs,src/astrology/scheduler.rs, andmain.bpf.chave indentation depth 6, making control flow hard to follow. Flattening with early returns is recommended. - Medium – Oversized C file –
main.bpf.ccontains 633 lines; splitting into logical units would reduce change impact.
Additional observations: the repository includes a lockfile (Cargo.lock) but no Cargo.toml‑level version pinning beyond the manifest, and no Dependabot configuration.
The Bottom Line
scx_horoscope demonstrates a complete, kernel‑level scheduler built with Rust and BPF, and the source is organized around clear domain modules. However, the lack of licensing, tests, and CI makes it risky for production adoption without additional engineering effort. It is suitable for experimental or research environments where the novelty of astrological weighting outweighs the maintenance overhead.