Expand description
The dynamic scheduler: token-based activation over BSP supersteps.
Edge evaluation emits tokens onto edges; a node joins the next frontier when its
Activation policy is satisfiable from pending (unconsumed) tokens, and activation
consumes them. This is process-network/Kahn-style firing, and it makes loops fall out
naturally: a back-edge simply delivers another token to an earlier node, which refires.
There is no “executed once” set and no special loop construct.
§Circuit breakers
Loops make runaway execution possible by construction, so bounds are part of the core:
- a global
BspEngine::with_max_stepssuperstep cap producingEngineResult::StepLimitReached— a first-class result carrying the live run state, never a silent salvage; - per-edge
max_iterationsbudgets raisingBspError::LoopBoundExceeded; - optional per-node
max_executionscaps; - a pending-token cap per edge (
BspEngine::with_max_pending_tokens) against floods.
§Joins inside loops are almost always Any or merger-joins
An All-join on a cycle is the classic self-deadlock — one predecessor’s token
arrives once per iteration, the other’s arrives once ever, so the join waits forever
and the run ends in BspError::Deadlock:
entry ──▶ J (All) ──▶ body
▲ │
└────────────┘ J needs a token on BOTH edges per firing,
back-edge but entry only ever fires once → stallValidation warns on this shape; write the loop join as Any (or a merger-join).
Structs§
- BspEngine
- The dynamic scheduler that organizes nodes into supersteps and executes them concurrently (bounded), re-executing nodes as loops deliver new activation tokens.
- Validation
Report - The result of graph validation: fatal errors plus non-fatal findings.
Constants§
- DEFAULT_
MAX_ PENDING_ TOKENS - The default cap on pending (unconsumed) tokens per edge (token-flood guard).
- DEFAULT_
MAX_ STEPS - The default global superstep budget (circuit breaker). The pre-rewrite engine had no
cap; loops make one mandatory, so a generous default is baked in — tune it with
BspEngine::with_max_steps.
Type Aliases§
- Branch
Transform - A transform applied to each branch-state clone at multi-node frontier formation,
right after the clone is taken from the trunk (see
BspEngine::with_branch_transform). Theusizeis the branch’s ordinal within the frontier formation (declaration order, 0-based).