Cyclic scan execution¶
Foundation capability (taktora-executor v0.1): periodic execution of a scheduled item at a configured scan period — the PLC equivalent of a scan cycle — plus the absolute-grid dispatch, EINTR-immune run loop, and tight timer-slack guarantees that bound long-run cyclic precision.
Periodic execution of a scheduled item at a configured scan period — the PLC equivalent of a scan cycle. |
The runtime shall allow each cyclic item to declare a scan period as a
|
Under nominal load (no item exceeding its scan period), the runtime shall invoke each cyclic item exactly once per declared period. A cyclic task shall declare exactly one scan period; multiple
|
The runtime shall emit pre-execute and post-execute timestamps for
every scan-cycle invocation through the |
The runtime shall phase-lock cyclic dispatch to an absolute monotonic
grid: the nominal wakeup for scan k of a cyclic item is
This strengthens One execution per scan period (REQ_0002) (“exactly once per declared period”): firing once per period is necessary but not sufficient, because a relative interval timer satisfies it while still drifting — the per-cycle wakeup→dispatch round-trip leaks into the next interval and the grid slides. Firing once per period is required; the grid must also not slide. A wakeup starved past one or more whole periods shall skip the missed slots — re-aligning to the next future grid point and dispatching exactly once — and shall never replay a burst of stale cycles, so a transient stall costs bounded slots rather than a permanent phase offset. Where multiple cyclic items declare different periods, every cadence shares the one scheduling epoch (a harmonic grid), so all periods phase-align at the epoch. The scheduling time source shall be distinct from the telemetry measurement clock that produces the lateness of Per-task deadline lateness (REQ_0106), so that substituting a test clock for telemetry can never alter dispatch timing. The lateness of Per-task deadline lateness (REQ_0106) remains the independent witness for this requirement: every timestamp it folds is read from the telemetry clock, never from the scheduler. Exactly two discrete scheduling facts cross into telemetry: the skipped-slot count of Per-task skipped-slot count (REQ_0840) and the one-shot first-dispatch anchor offset of Per-task deadline lateness (REQ_0106) — a loud countable event and a single constant, not a timing source — so a drifting scheduler can at most shift the witness’s constant anchor once and still cannot mask its own accumulating drift in the witness metric. Verification is by a deterministic unit test over the grid state machine — the nominal target advances by exactly one period per cycle with zero accumulated offset, and a simulated stall skips whole slots; the long-run hardware drift bound is recorded as field evidence in Absolute-grid cyclic dispat... (ADR_0100). |
A bare Rationale: the dispatch loop is the cyclic control plane. Treating an
interrupted wait as a termination request silently freezes a PLC
runtime’s outputs with exit code 0 — observed on the Pi5 rig, where a
single |
On Linux the runtime shall set the dispatch thread’s timer slack to
1 µs at dispatch-loop entry. Field evidence (Pi5, idle, |