Deterministic Scheduler
The engine that beats at the heart of the Ved runtime is the Deterministic Scheduler.
In most modern programming languages (Go, Java, Rust), scheduling is non-deterministic. The Operating System or an internal runtime thread pool decides when a specific coroutine, goroutine, or thread gets CPU time. This creates fundamentally unpredictable execution orders—meaning a race condition that happens in production might physically never occur on a developer's laptop because the OS thread scheduler behaved slightly differently.
Ved eliminates this entire class of bugs by taking absolute control over execution ordering.
Logical Determinism
Ved operates on a model of Logical Central Determinism.
Regardless of whether the Ved runtime is executing on a single laptop or distributed across a five-node Raft-consensus cluster, the sequence of executed Transitions is strictly, mathematically ordered.
The scheduler computes priority using a deterministic algorithm based on:
- Goal Priority (Critical vs Background)
- Authority Level (Environment > Workspace)
- Lexical ID Tie-Breakers
If two external network responses arrive at the exact same physical millisecond, the scheduler does not randomly pick one to process first. It forces them into a mathematically reproducible sequence.
The Fairness Budget
Because a Domain might need to process heavy computational logic, the Scheduler enforces strict Fairness Budgets.
Transitions in Ved are composed of Execution Slices. The Scheduler acts as a Preemptive Arbitrator:
- It grants a Domain permission to execute a single Slice.
- Once the Slice completes, the Scheduler checks its cue.
- If a higher-priority task (e.g., an Environment-level failover command) has arrived, the Scheduler pre-empts the current Domain immediately, snapshots its state, and gives CPU time to the critical task.
This guarantees that a runaway calculation in a low-priority Domain can never starve a critical infrastructure control loop.
Implications for Scalability
Choosing logical determinism is a profound architectural trade-off.
- The Cost: It introduces a theoretical scalability ceiling. You cannot blindly spray millions of unstructured, parallel mutations across a cluster without coordination overhead.
- The Benefit: It grants complete System Correctness. You can download a multi-gigabyte production state snapshot to your laptop, feed it the same inbound message log, and the exact same sequence of instruction execution will occur natively.
Ved trades raw, chaotic parallelism for absolute, ironclad predictability. For the domain of infrastructure orchestration and reliable control planes, predictability is infinitely more valuable.