nx_swarm_arbitrate.nx
buildroot/runtime/nx_swarm_arbitrate.nx
about
nx_swarm_arbitrate.nx -- SWARM FABRIC cross-workstream RESOURCE ARBITRATION (SF-ARB): the layer that
keeps COMPETING workstreams (a gen job, LLM inference, model training) sharing the ONE heterogeneous
pool FAIRLY -- no workstream monopolizes, none starves, high-priority preempts low. This is the
orchestration north-star's R-ORCH-4 (competing-workstream arbitration) for RESOURCES, and it FEEDS
nx_resource_arbiter (which already models VRAM/RAM/CPU/GPU allocation with max-share fairness +
priority + preemption but was "fed by nothing").
COMPOSES (check-before-build 2026-07-15): nx_resource_arbiter (nx_ra_new / set_budget / set_max_share /
request / preempt / total_held) -- verified compiles+gates today. This organ is the FEED (pool budgets
from fleet totals = the beacon telemetry) + the workstream-request driver + the fairness gate. It does
NOT reimplement allocation -- that's the arbiter's job (rule 15 DRY / rule 9 single-responsibility:
pack places chunks on participants; THIS shares the pool across workstreams; the arbiter allocates).
★★THE LIAR-KILLERS: (1) NO-MONOPOLY -- a workstream requesting > max-share of a resource is DENIED_MAX_
SHARE (can't take the whole pool). (2) NO-STARVATION -- after the greedy high-demand workstream is
capped, a lower one still gets a (partial) grant, never zero-by-design. (3) BUDGET-HONEST -- total
granted never exceeds the pool. (4) PRIORITY-PREEMPTION -- a higher-priority workstream reclaims from a
lower one. (5) determinism.
nx_swarm_arbitrate -- self-gate: the competing-workstream fairness scenario
license_tier: ORIGINAL expect_exit:0
dependencies 1 imports · 0 importers
imports: nx_resource_arbiter.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const K_MAGIC_1000000: i64 = 1000000 |
| 23 | const K_MAGIC_20000: i64 = 20000 |
| 24 | const K_MAGIC_15000: i64 = 15000 |
| 25 | const K_MAGIC_10000: i64 = 10000 |
| 26 | const K_MAGIC_8000: i64 = 8000 |
| 27 | const K_MAGIC_5000: i64 = 5000 |
| 28 | const K_MAGIC_2000: i64 = 2000 |
| 29 | const K_MAGIC_3000: i64 = 3000 |
functions
| 31 | func sa_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 32 | func sa_putn(v: i64) -> i64 |
| 45 | func sa_report(name: *u8, v: i64, granted: i64) -> i64 |
| 51 | func main() -> i64 |