code wiki / _hdl_build / nx_poolwidth_lib.nx

nx_poolwidth_lib.nx

buildroot/runtime/_hdl_build/nx_poolwidth_lib.nx

9453 B184 linesdepth 5pulls 7 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_poolwidth_lib.nx -- ONE headroom-derived width governor for every pool in the ecosystem (seq1402). THE DEFECT, MEASURED 2026-07-30: nx_torrent_get.nx:717 carries `let MAXP: i64 = 32` -- a hardcoded literal (rule-11) -- and refills every free slot every 2s. That is 16 forks/sec PER INSTANCE. The box measured **143 forks/sec at load 11.72 on 8 threads**, which is ~9 concurrent instances. NOBODY CHOSE 143. It is 32 x N, and N is whatever the operator queued. ★★LAW: A PER-INSTANCE LIMIT IS NOT A LIMIT. N instances multiply it and nobody ever picks N. ★WHAT THIS IS *NOT*: a backoff. nx_torrent_get.nx:711-716 documents constant connection cycling as the BitTorrent throughput strategy (continuous optimistic-unchokes vs fast-burst-then-freeze). Throttling the CYCLING would attack the feature to flatten a graph -- operator rule 25, build intelligence, never strip it. This governs only the WIDTH; inside its budget the pool stays as aggressive as it ever was. The same law already bit the crawl pool (seq1288 saturation-wedge: "pool width must be HEADROOM-DERIVED"). Two lanes, one defect => ONE primitive, not two fixes (rule 15). license_tier: ORIGINAL Pure. No hw writes (Rule 26).

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_hw.nx nx_ctxtop_lib.nx nx_proc_ctl.nx nx_poolwidth_lib.nx nx_poolwidth_gate.nx

imports: nx_syscalls.nxnx_hw.nxnx_ctxtop_lib.nxnx_proc_ctl.nx

imported by: nx_poolwidth_gate.nx

structs

none

consts

22const PW_DIRBUF: i64 = 65536
23const PW_PATHBUF: i64 = 256
24const PW_CMDBUF: i64 = 8192
25const PW_LOADBUF: i64 = 128
111const PW_UNKNOWN_LOAD: i64 = 0 - 1

functions

29func pw_load_centi() -> i64
46func pw_count_procs(needle: *u8) -> i64
127func pw_budget_from_hw(slots_per_cpu: i64, floor: i64) -> i64
called by 1: main calls 1: nx_hw_cpu_count
149func pw_width(total_budget: i64, n_instances: i64, load_centi: i64,
called by 1: main
168func pw_aggregate(width: i64, n_instances: i64) -> i64
179func pw_within_budget(width: i64, n_instances: i64, total_budget: i64) -> i64
called by 1: main calls 1: pw_aggregate