Skip to content

Harmonic Scheduler

Complete

The Harmonic Scheduler is Rumpk's cooperative, priority-based scheduling system. It organizes all work into four time spectrums, each with a deterministic deadline.

The Four Spectrums

SpectrumDeadlinePurposeExample
Photon2msReal-time, interrupt-criticalDMA completion, hardware IRQ handling, audio buffers
Matter10msInteractive, network-sensitiveNetwork packet processing, input events, display frames
Gravity50msBackground computationFile indexing, cache warming, non-urgent I/O
VoidUnlimitedIdle, opportunisticGarbage collection, telemetry upload, housekeeping

How It Works

The scheduler maintains four priority queues — one per spectrum. On each scheduling tick:

  1. All Photon fibers run first (hard deadline: 2ms)
  2. If time remains, Matter fibers run (deadline: 10ms)
  3. If time remains, Gravity fibers run (deadline: 50ms)
  4. If all higher-priority work is done, Void fibers run

A fiber declares its spectrum when it is spawned. The spectrum is encoded in bits [63:62] of the pledge mask, making it a security property — a fiber cannot promote itself to a higher spectrum.

Tickless Design

The scheduler is tickless. It does not use a periodic timer interrupt. Instead:

  • Hardware timer is programmed to fire at the next fiber's deadline
  • If no work is pending, the CPU enters a low-power sleep state
  • When an interrupt or ION Ring message arrives, the scheduler wakes and processes it immediately

This design is critical for embedded and satellite deployments where power consumption matters.

Cooperative, Not Preemptive

Within the kernel, scheduling is cooperative. Fibers yield explicitly. This is a deliberate design choice:

  • Cooperative scheduling eliminates race conditions
  • No need for kernel-level locks or atomic operations
  • Deterministic behavior — you can prove execution order

Preemption only happens at spectrum boundaries: if a Photon fiber becomes ready while a Gravity fiber is running, the Gravity fiber is preempted.

Kinetic Budget Integration

Each fiber has an energy budget managed by the Kinetic Economy. If a fiber exceeds its budget:

  1. First strike: Warning logged to ProvChain
  2. Second strike: Fiber demoted to lower spectrum
  3. Third strike: Fiber killed and restarted

This three-strike ratchet prevents DoS by misbehaving or compromised fibers.

ECC Scrubbing

On radiation-hardened deployments (Nexus Unikernel profile), the scheduler integrates ECC memory scrubbing into Void-spectrum idle time. When no productive work is pending, the CPU walks memory and corrects single-bit errors before they accumulate into uncorrectable multi-bit errors.

Released under the CC0 License.