|
1 | 1 | # AOS-0008 — IPC and Timing Contract |
2 | 2 |
|
3 | 3 | Status: Draft 0.1 — pre-normative. |
4 | | -Audience: implementers, reviewers, safety assessors, researchers, and institutional partners. |
| 4 | +Audience: kernel implementers, embedded systems engineers, safety reviewers, validation engineers, SDK authors, and hardware-in-the-loop test authors. |
5 | 5 | Normative force: draft language only until AxonOS Standard v1.0. |
6 | 6 |
|
7 | 7 | ## 1. Purpose |
8 | 8 |
|
9 | | -AOS-0008 defines draft expectations for bounded IPC and timing claims. |
| 9 | +This artifact defines the draft IPC and timing contract for AxonOS implementations. |
10 | 10 |
|
11 | | -## 2. Scope |
| 11 | +AxonOS exists because BCI software cannot treat timing as a convenience metric. |
| 12 | +In a closed-loop neural system, timing violations can corrupt signal continuity, |
| 13 | +misalign intent windows, invalidate classifier state, or produce unsafe actuation |
| 14 | +behavior. Therefore a timing claim must be stated as a bounded claim under stated |
| 15 | +assumptions, not as an average or marketing number. |
12 | 16 |
|
13 | | -This artifact defines draft standard semantics for AxonOS implementations. It is not a clinical protocol, regulatory approval, or certification claim. It exists to make implementation claims explicit, reviewable, and testable. |
| 17 | +This artifact defines the required shape of a real-time claim, the required |
| 18 | +shape of an IPC claim, deadline and response-time terminology, buffer and queue |
| 19 | +contract fields, failure behavior for overrun and deadline miss, evidence levels |
| 20 | +for timing claims, minimum conformance tests, and non-conformance examples. |
14 | 21 |
|
15 | | -AxonOS repositories should reference this artifact when their README, API, tests, or documentation make claims in this area. |
| 22 | +Draft 0.1 does not define a final byte-level ABI. It defines the contract that |
| 23 | +future ABI and wire-format artifacts must satisfy. |
16 | 24 |
|
| 25 | +## 2. Timing vocabulary |
17 | 26 |
|
18 | | -## 3. Timing claim form |
| 27 | +| Term | Meaning | |
| 28 | +|---|---| |
| 29 | +| `T_i` | Period of task `i` | |
| 30 | +| `D_i` | Relative deadline of task `i` | |
| 31 | +| `C_i` | Worst-case execution time of task `i` | |
| 32 | +| `R_i` | Worst-case response time of task `i` | |
| 33 | +| `U_i` | Utilisation contribution `C_i / T_i` | |
| 34 | +| `U_total` | Sum of admitted task utilisations | |
| 35 | +| `U_max` | Implementation-defined admission ceiling | |
| 36 | +| WCET | Worst-case execution time under stated assumptions | |
| 37 | +| WCRT | Worst-case response time under stated scheduling model | |
| 38 | +| IPC | Inter-process or inter-core communication mechanism | |
| 39 | +| overrun | Producer cannot enqueue because bounded capacity is exhausted | |
| 40 | +| deadline miss | Job completion occurs after its declared deadline | |
19 | 41 |
|
20 | | -A timing claim should include deadline, bound, hardware context, workload, method, evidence level, and falsification threshold. |
| 42 | +A timing claim without a declared deadline and bound is not an AxonOS timing claim. |
21 | 43 |
|
22 | | -## 4. IPC claim form |
| 44 | +## 3. Minimum real-time claim record |
23 | 45 |
|
24 | | -An IPC claim should identify queue type, capacity, producer/consumer model, blocking behavior, overrun behavior, memory ordering, and unsafe-code surface. |
| 46 | +Every AxonOS timing claim should be expressible in the following form: |
25 | 47 |
|
26 | | -## 5. Deadline miss behavior |
| 48 | +```text |
| 49 | +Claim: |
| 50 | + component: |
| 51 | + task/stage: |
| 52 | + hardware: |
| 53 | + clock: |
| 54 | + period: |
| 55 | + deadline: |
| 56 | + WCET or WCRT bound: |
| 57 | + scheduling model: |
| 58 | + workload assumptions: |
| 59 | + evidence level: |
| 60 | + artifact: |
| 61 | + falsification threshold: |
| 62 | + limitations: |
| 63 | +``` |
27 | 64 |
|
28 | | -A safety-relevant implementation should document behavior on deadline miss. |
| 65 | +This format prevents mixing predicted, measured, and certified claims. |
29 | 66 |
|
30 | | -## 6. Bounded behavior |
| 67 | +## 4. IPC contract record |
31 | 68 |
|
32 | | -Bounded IPC means operation count and memory use are bounded under stated conditions. |
| 69 | +Every IPC mechanism used in an AxonOS real-time boundary should declare: |
33 | 70 |
|
34 | | -## 7. Evidence mapping |
| 71 | +| Field | Required description | |
| 72 | +|---|---| |
| 73 | +| `name` | IPC mechanism name | |
| 74 | +| `role` | signal path, control path, diagnostic path, or application path | |
| 75 | +| `producer` | single producer, multiple producer, interrupt producer, DMA producer | |
| 76 | +| `consumer` | single consumer, task consumer, application consumer, inter-core consumer | |
| 77 | +| `capacity` | slot count or byte capacity | |
| 78 | +| `slot_size` | byte size of each slot, if fixed | |
| 79 | +| `alignment` | required alignment in bytes | |
| 80 | +| `endianness` | byte order for serialized fields | |
| 81 | +| `blocking_behavior` | wait-free, lock-free, bounded wait, blocking, or unknown | |
| 82 | +| `overrun_behavior` | reject, drop-newest, drop-oldest, backpressure, fault | |
| 83 | +| `memory_ordering` | ordering discipline for payload visibility | |
| 84 | +| `unsafe_surface` | unsafe code or equivalent low-level primitive | |
| 85 | +| `evidence_level` | evidence supporting the claim | |
35 | 86 |
|
36 | | -Instruction-count derivations are L1. Runtime fixture measurements are L2. External GPIO or analyzer traces are L3. |
| 87 | +If a repository cannot fill this table, it should not claim AxonOS IPC conformance. |
37 | 88 |
|
38 | | -## 8. Draft requirements |
| 89 | +## 5. Draft queue profile: SPSC-RT |
39 | 90 |
|
40 | | -A draft implementation aligned with this artifact should satisfy: |
| 91 | +Draft 0.1 defines an initial queue profile named `SPSC-RT`. |
41 | 92 |
|
42 | | -1. State deadlines and bounds for real-time claims. |
43 | | -2. Document IPC capacity and overrun behavior. |
44 | | -3. Document unsafe-code surface if any. |
45 | | -4. State deadline miss behavior. |
46 | | -5. Tag timing claims with evidence levels. |
| 93 | +`SPSC-RT` is a single-producer/single-consumer bounded queue suitable for a |
| 94 | +real-time signal path if all of the following hold: |
47 | 95 |
|
48 | | -## 9. Minimum verification expectations |
| 96 | +1. capacity is fixed at compile time or initialization time; |
| 97 | +2. producer operation has bounded step count; |
| 98 | +3. consumer operation has bounded step count; |
| 99 | +4. no heap allocation occurs on the hot path; |
| 100 | +5. overrun behavior is explicit; |
| 101 | +6. payload visibility is governed by documented memory ordering; |
| 102 | +7. unsafe code surface is documented and tested; |
| 103 | +8. queue state can be reset or faulted safely. |
49 | 104 |
|
50 | | -1. Tests cover queue invariants where applicable. |
51 | | -2. Documentation states overrun behavior. |
52 | | -3. Claims register includes timing entries. |
53 | | -4. Hardware claims identify context. |
54 | | -5. L3 claims include trace artifact references. |
| 105 | +`SPSC-RT` does not require a specific implementation. A ring buffer, static queue, |
| 106 | +or hardware mailbox may qualify if the contract is satisfied. |
55 | 107 |
|
56 | | -## 10. Non-conformance examples |
| 108 | +## 6. Draft packet layout requirements |
57 | 109 |
|
58 | | -The following are examples of non-conforming or misleading use: |
| 110 | +A future stable ABI may define byte-level packet formats. Until then, any IPC |
| 111 | +packet or event frame crossing an AxonOS boundary should document at minimum: |
59 | 112 |
|
60 | | -1. Real-time claim with only average latency. |
61 | | -2. IPC claim without capacity. |
62 | | -3. Lock-free claim without evidence. |
63 | | -4. Deadline miss behavior undocumented. |
64 | | -5. Measured claim with no artifact. |
| 113 | +| Field | Requirement | |
| 114 | +|---|---| |
| 115 | +| magic/version | identifies frame family and version | |
| 116 | +| frame_type | typed event, control, consent, safety, diagnostic, etc. | |
| 117 | +| length | payload length in bytes | |
| 118 | +| sequence | monotonic counter or sequence number if ordered | |
| 119 | +| timestamp | monotonic timestamp or declared absence | |
| 120 | +| source | component or node identity | |
| 121 | +| flags | delivery, safety, or compatibility flags | |
| 122 | +| payload | typed payload, schema-defined | |
| 123 | +| integrity | checksum, MAC, signature, or declared absence | |
65 | 124 |
|
66 | | -## 11. Open issues |
| 125 | +Endianness must be explicit. Alignment requirements must be explicit. Reserved |
| 126 | +fields must have defined default values. |
67 | 127 |
|
68 | | -Draft 0.1 intentionally leaves some details unresolved. Future revisions may add machine-readable schemas, test vectors, stricter conformance profiles, and implementation-version mappings. Any promotion from draft text to normative text must be recorded through the governance process. |
| 128 | +## 7. Example frame envelope |
69 | 129 |
|
70 | | -## 12. Summary |
| 130 | +Draft 0.1 does not freeze ABI bytes, but a future frame envelope should be able |
| 131 | +to express the following conceptual layout: |
71 | 132 |
|
72 | | -This artifact defines one part of the AxonOS Standard boundary. It should be read together with AOS-0000 through AOS-0011 and the repository-level `CONFORMANCE.md`, `VALIDATION.md`, and `GOVERNANCE.md` documents. |
| 133 | +```text |
| 134 | +0 1 2 3 |
| 135 | +0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 136 | ++-------------------------------+-------------------------------+ |
| 137 | +| magic/version | frame_type | |
| 138 | ++-------------------------------+-------------------------------+ |
| 139 | +| header_len | payload_len | |
| 140 | ++-------------------------------+-------------------------------+ |
| 141 | +| sequence_low | |
| 142 | ++---------------------------------------------------------------+ |
| 143 | +| sequence_high | |
| 144 | ++---------------------------------------------------------------+ |
| 145 | +| timestamp_low | |
| 146 | ++---------------------------------------------------------------+ |
| 147 | +| timestamp_high | |
| 148 | ++---------------------------------------------------------------+ |
| 149 | +| source_id | |
| 150 | ++---------------------------------------------------------------+ |
| 151 | +| flags | reserved | |
| 152 | ++-------------------------------+-------------------------------+ |
| 153 | +| payload ... | |
| 154 | ++---------------------------------------------------------------+ |
| 155 | +| integrity ... | |
| 156 | ++---------------------------------------------------------------+ |
| 157 | +``` |
| 158 | + |
| 159 | +The exact byte width of each field is not normative in Draft 0.1. The normative |
| 160 | +requirement is that future byte-level definitions must not leave versioning, |
| 161 | +length, ordering, timestamp semantics, or integrity semantics implicit. |
| 162 | + |
| 163 | +## 8. Deadline miss behavior |
| 164 | + |
| 165 | +A safety-relevant implementation must document behavior on deadline miss. |
| 166 | + |
| 167 | +Acceptable responses may include reject current output, enter degraded mode, |
| 168 | +trigger backpressure, clear affected queue, enter safe idle, disable stimulation, |
| 169 | +emit safety event, fault session, or log transition. |
| 170 | + |
| 171 | +Unacceptable default behavior includes silently delivering stale intent, silently |
| 172 | +skipping safety state update, continuing stimulation with stale classification, |
| 173 | +hiding the deadline miss from audit trail, or converting hard deadlines into |
| 174 | +best-effort scheduling without documentation. |
| 175 | + |
| 176 | +## 9. Overrun behavior |
| 177 | + |
| 178 | +Overrun behavior must be explicit. |
| 179 | + |
| 180 | +| Policy | Meaning | Safety note | |
| 181 | +|---|---|---| |
| 182 | +| reject-new | producer returns error; existing data preserved | often safest for control paths | |
| 183 | +| drop-new | incoming item discarded | must be audited | |
| 184 | +| drop-old | oldest item discarded | dangerous for signal continuity | |
| 185 | +| backpressure | producer slows or blocks | must be bounded | |
| 186 | +| fault | system enters fault state | appropriate for safety-critical paths | |
| 187 | + |
| 188 | +For a safety-critical neural signal path, silent drop-old behavior is presumptively |
| 189 | +non-conformant unless justified by a bounded safety case. |
| 190 | + |
| 191 | +## 10. Priority inversion and blocking |
| 192 | + |
| 193 | +If the IPC or timing path can block, the implementation must document maximum |
| 194 | +blocking time, priority inheritance or ceiling protocol, scheduler interaction, |
| 195 | +interrupt masking duration, critical-section duration, and deadlock avoidance |
| 196 | +argument. |
| 197 | + |
| 198 | +A system with unbounded blocking in the critical neural path cannot claim hard |
| 199 | +real-time AxonOS alignment. |
| 200 | + |
| 201 | +## 11. Timing jitter |
| 202 | + |
| 203 | +Jitter claims must distinguish release jitter, completion jitter, transport |
| 204 | +jitter, scheduler jitter, measurement jitter, clock drift, and timestamp |
| 205 | +quantization. |
| 206 | + |
| 207 | +A claim such as "low jitter" is insufficient. The claim must state what jitter |
| 208 | +is being measured and how. |
| 209 | + |
| 210 | +## 12. Evidence mapping |
| 211 | + |
| 212 | +| Evidence level | Timing evidence example | |
| 213 | +|---|---| |
| 214 | +| L0 | design intent or architecture sketch | |
| 215 | +| L1 | analytical bound, instruction-count derivation, model check | |
| 216 | +| L2 | measured on development fixture | |
| 217 | +| L3 | externally instrumented trace: GPIO, logic analyzer, oscilloscope | |
| 218 | +| L4 | independent reproduction or review | |
| 219 | +| L5 | formal regulatory/certification evidence | |
| 220 | + |
| 221 | +An L1 timing proof does not become L3 because it is precise. L3 requires an |
| 222 | +external measurement artifact. |
| 223 | + |
| 224 | +## 13. Minimum test expectations |
| 225 | + |
| 226 | +A draft AxonOS timing implementation should provide tests or artifacts for queue |
| 227 | +capacity enforcement, overrun behavior, enqueue/dequeue invariants, memory |
| 228 | +ordering or equivalent visibility argument, deadline miss reporting, timestamp |
| 229 | +monotonicity, reset behavior, fault behavior after corrupted queue state, no heap |
| 230 | +allocation on declared hot path, and documentation of unsafe surface. |
| 231 | + |
| 232 | +## 14. Conformance requirements |
| 233 | + |
| 234 | +A draft AxonOS IPC/timing implementation should satisfy: |
| 235 | + |
| 236 | +1. timing claims include deadline and bound; |
| 237 | +2. IPC capacity is documented; |
| 238 | +3. IPC overrun behavior is documented; |
| 239 | +4. blocking behavior is documented; |
| 240 | +5. memory ordering or visibility semantics are documented; |
| 241 | +6. unsafe or low-level surface is documented; |
| 242 | +7. deadline miss behavior is documented; |
| 243 | +8. evidence level is declared; |
| 244 | +9. L3 claims include trace artifact references; |
| 245 | +10. hidden best-effort conversion is prohibited. |
| 246 | + |
| 247 | +## 15. Non-conformance examples |
| 248 | + |
| 249 | +The following are non-conforming or misleading: real-time claim with only average |
| 250 | +latency, queue with undocumented capacity, lock-free claim without implementation |
| 251 | +evidence, wait-free claim with hidden retry loop, L3 claim without trace artifact, |
| 252 | +silent deadline miss, silent drop-old overrun in signal path, unbounded mutex in |
| 253 | +critical neural path, IPC packet with no version field, and serialized event with |
| 254 | +unknown endianness. |
| 255 | + |
| 256 | +## 16. Release checklist for an IPC/timing claim |
| 257 | + |
| 258 | +Before an AxonOS repository publishes an IPC/timing claim, the maintainer should |
| 259 | +verify: |
| 260 | + |
| 261 | +- the hardware target is named; |
| 262 | +- the clock source is named; |
| 263 | +- the scheduler or execution model is named; |
| 264 | +- queue capacity is named; |
| 265 | +- overrun behavior is named; |
| 266 | +- deadline miss behavior is named; |
| 267 | +- blocking behavior is named; |
| 268 | +- memory ordering or equivalent visibility semantics are named; |
| 269 | +- the claim appears in the claims register; |
| 270 | +- the evidence level is stated; |
| 271 | +- the artifact is linked; |
| 272 | +- the falsification threshold is stated. |
| 273 | + |
| 274 | +This checklist is intentionally strict because real-time BCI claims are easy to |
| 275 | +overstate and difficult to repair after publication. |
| 276 | + |
| 277 | +## 17. Open issues |
| 278 | + |
| 279 | +Draft 0.1 leaves unresolved: stable ABI for typed intent events, canonical packet |
| 280 | +byte layout, canonical capability descriptor layout, shared-memory mailbox |
| 281 | +profile, multi-producer queue profile, inter-core timing profile, conformance |
| 282 | +test vectors, and hardware trace artifact schema. |
| 283 | + |
| 284 | +## 18. Summary |
| 285 | + |
| 286 | +AxonOS timing claims must be bounded, falsifiable, and evidence-tagged. |
| 287 | + |
| 288 | +The standard does not forbid experimentation. It forbids presenting best-effort |
| 289 | +behavior as hard real-time evidence. |
0 commit comments