Skip to main content

Module budget

Module budget 

Source
Expand description

Runtime resource control.

ADR 0001 makes termination and CPU usage runtime concerns rather than properties the type system proves: “Totality, determinism, and absence of loops are explicitly not MVP guarantees.” This module is where that decision becomes code. A Budget tracks one run against the Limits a host chose, and the interpreter consults it at safepoints — loop back edges, calls, and await — rather than at arbitrary points, so the cost of enforcement is bounded and predictable.

Structs§

Budget
Tracks one run against its Limits.
Cancellation
A cancellation flag shared with whoever may cancel the run.
Limits
Limits a host imposes on one run.
Meter
One run’s budget as a safepoint charges it: a handle every task thread can hold at once, over counters that need no lock.

Enums§

Stopped
Why execution was stopped.

Constants§

DEADLINE_CHECK_INTERVAL
How many Budget::safepoint calls pass between checks of the wall clock when a deadline is set.