Skip to content

maman/scx_weton

 
 

Repository files navigation

scx_weton - Javanese Weton CPU Scheduler

"Primbon-driven scheduling for the spiritually aligned"

A fully functional sched_ext scheduler that makes real CPU scheduling decisions based on the Javanese Weton calendar system, including pasaran cycles, neptu calculations, and traditional primbon divination. This actually loads into the Linux kernel and schedules your system tasks. Because if the ancient Javanese calendar can determine auspicious dates for weddings, why not CPU scheduling too?

Demo

Features

  • Weton Calendar Calculation: Uses the 35-day selapanan cycle combining 7-day saptawara with 5-day pasaran
  • Pasaran-Based Task Classification: Tasks are classified by their ruling pasaran (Legi, Pahing, Pon, Wage, Kliwon)
  • Pancasuda Cycle: Daily fortune modifier from Sri/Lungguh/Dunya/Lara/Pati - with Pati triggering 50% time slice penalty
  • Neptu Fate Compatibility: Jodoh neptu system for task-day compatibility (Pesthi, Pegat, Ratu, Jodoh, etc.)
  • Lunar Phase Scheduling: Moon phases (Purnama/Tilem) affect task energy from traditional primbon
  • Jam Jawa Time Periods: Eight traditional Javanese time divisions affect scheduling throughout the day
  • Weton Weather Reports: Get real-time weton guidance with today's pasaran, pancasuda, lunar phase, and jam jawa
  • Actually Works: Loads into the Linux kernel via sched_ext and schedules real system processes
  • Real BPF Integration: Uses scx_rustland_core framework for kernel-userspace communication
  • Dynamic Time Slicing: Adjusts CPU time based on weton-derived priority (100-1000)

Weton Scheduling Rules

Pasaran Rulerships

Each pasaran rules specific types of system tasks based on directional and elemental qualities:

Task Type Ruling Pasaran Direction Element Rationale
Interactive Legi East (Wetan) Wood/Air Rising energy, user-facing
CPU-Intensive Pahing South (Kidul) Fire Intensity, raw power
System Pon West (Kulon) Metal Balance, stability
Memory Wage North (Lor) Water Grounding, depth
Network/I/O Kliwon Center (Tengah) Earth Connecting, bridging
Desktop Legi East (Wetan) Wood/Air User-facing, light
Critical (all) - - High base priority

Pasaran Element Effects

When today's pasaran matches a task's ruling pasaran:

  • Legi (Wood/Air) boosts Interactive & Desktop tasks: 1.5x
  • Pahing (Fire) boosts CPU-intensive tasks: 1.5x
  • Pon (Metal) boosts System tasks: 1.5x
  • Wage (Water) boosts Memory tasks: 1.5x
  • Kliwon (Earth) boosts Network tasks: 1.5x

Non-matching pasaran combinations are neutral (1.0x).

Pancasuda Effects (Daily Fortune)

Based on the total neptu (day + pasaran) modulo 5:

Pancasuda Multiplier Effect
Sri 1.3x Prosperity, abundance
Lungguh 1.2x Honorable status
Dunya 1.4x Worldly fortune (best!)
Lara 0.8x Temporary obstacles
Pati 0.5x Endings, worst day (50% time slice penalty)

Neptu Fate Compatibility (Jodoh Neptu)

Traditional primbon compatibility using (weton_neptu + task_neptu) % 8:

Fate Multiplier Meaning
Ratu 1.5x Royalty, success (best)
Pesthi 1.4x Harmony, peace
Tinari 1.4x Abundance
Jodoh 1.3x Connection
Topo 1.0x Discipline
Sujanan 0.9x Uncertainty
Padu 0.8x Conflict
Pegat 0.7x Disruption (worst)

Priority Formula

final_priority = base_priority x pasaran_match x fate_modifier x pancasuda_modifier x lunar_modifier x jam_modifier
time_slice = min_slice + (base_slice - min_slice) x (priority / 1000)
if pancasuda == Pati: time_slice x 0.5

Base Priorities:

  • Critical (PID 1): 1000
  • System tasks: 200
  • Interactive tasks: 150
  • Desktop/UI: 120
  • CPU/Network: 100
  • Memory: 80

Installation

NOTE: userspace schedulers require kernels 6.12 or later.

cargo build --release

If you're using NixOS, you can also add provided flake like this (25.11+ required):

  # Include this flake
  inputs.scx_weton.url = "github:zampierilucas/scx_weton";

  ...

  # Include module
  outputs = { self, nixpkgs, scx_weton, ... }@inputs: {
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      modules = [
        scx_weton.nixosModules.default
      ];
    };
  };

And then somewhere later in your system configuration:

  services.scx_weton = {
    enable = true;

    # Add options as needed
    extraArgs = [ "--cosmic-weather" ];
  };

Usage

Requires root privileges to load into the kernel as a sched_ext scheduler.

Running the Scheduler

# Build
cargo build --release

# Run with weton weather report and verbose output
sudo target/release/scx_weton --cosmic-weather -v

# Run with debug decisions to see individual task scheduling
sudo target/release/scx_weton --debug-decisions

# Stop: Press Ctrl+C for graceful shutdown

Command-Line Options

Weton Options:

  • -w, --cosmic-weather - Display today's weton, pancasuda, lunar phase, and jam jawa on startup
  • -d, --debug-decisions - Watch weton-based scheduling decisions in real-time
  • --no-pati - Disable Pati penalty (removes 50% time slice reduction on Pati days)
  • -u, --update-interval <SECS> - Update weton calculations every N seconds (default: 60)

Performance Tuning:

  • -s, --slice-us <MICROSECONDS> - Base time slice duration (default: 5000)
  • --slice-us-min <MICROSECONDS> - Minimum time slice (default: 500)
  • -v, --verbose - Display detailed statistics

Run --help to see all options.

Example: Scheduling on Selasa Legi

Date: February 3, 2026 (Tuesday/Selasa) at 10:30 AM

Today's weton: Selasa Legi (neptu = 3 + 5 = 8)

  • Pancasuda: 8 % 5 = 3 = Dunya (1.4x - best day!)
  • Lunar phase: Waxing Gibbous (1.3x)
  • Jam Jawa: Gumatel (1.3x base)

Interactive task (bash, ruled by Legi):

Pasaran match: Legi = Legi -> 1.5x
Fate: (8 + 5) % 8 = 5 -> Tinari (1.4x)
Pancasuda: Dunya (1.4x)
Lunar: 1.3x
Jam: Gumatel (1.4x with peak adjustment)

final_priority = 150 x 1.5 x 1.4 x 1.4 x 1.3 x 1.4 = 810 -> EXTREMELY BOOSTED

CPU task (rustc, ruled by Pahing):

Pasaran match: Legi != Pahing -> 1.0x
Fate: (8 + 9) % 8 = 1 -> Pegat (0.7x)
Pancasuda: Dunya (1.4x)
Lunar: 1.3x
Jam: Gumatel (1.5x with CPU peak adjustment)

final_priority = 100 x 1.0 x 0.7 x 1.4 x 1.3 x 1.5 = 191 -> BOOSTED despite bad fate

Disclaimer

This scheduler is 100% for educational and entertainment purposes. While the weton calculations are based on authentic Javanese primbon tradition and the scheduler actually works (it really does load into the kernel and schedule tasks!), using Javanese calendar cycles to schedule CPU tasks is:

  • Culturally fascinating but not scientifically validated for computing
  • Cosmically hilarious
  • Fully functional with real pancasuda, neptu fate, and lunar phase calculations
  • Not recommended for production systems (but it boots and runs stably)
  • Perfect for conference talks, hackathons, and proving that anything is possible

License

GPL-2.0-only (as required by sched_ext)

Contributing

Contributions welcome! The core scheduler is working, but there's always room for more cosmic chaos:

  • Add more pancasuda modifiers and neptu fate interactions
  • Process weton generation based on creation time (like birth charts)
  • Primbon predictions for task completion times
  • Weton compatibility (jodoh neptu) between parent and child processes
  • Extend jam jawa effects with more granular time periods
  • Add pawukon 210-day cycle integration

Acknowledgments

  • Norm for the hilarious and brilliant idea to schedule by the stars (now the calendar)
  • sched_ext team for the amazing BPF scheduler framework
  • The Javanese primbon tradition for millennia of calendrical wisdom
  • Karjanto & Beauducel for their academic work on Javanese calendar algorithms

"Eling lan waspada." (Be mindful and aware.)

Comments from people:

  • "You've made it work, but at what cost!"

About

Weton-based CPU Scheduler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 67.9%
  • C 29.3%
  • Nix 2.8%