nx_natbw_mt.nx
buildroot/runtime/nx_natbw_mt.nx
about
nx_natbw_mt.nx -- MULTI-THREAD memory-bandwidth probe (native-vs-WSL2).
N threads each stream their OWN 64MB buffer (4-acc, BW_PASSES times) and set a
done-flag; main spins until all set (no join syscall -> works identically on
Linux clone AND native CreateThread). Aggregate traffic = N*PASSES*64MB.
Timing is EXTERNAL (Measure-Command / date). Threads spawn via sys_thread_create,
a NAMED shim the native-PE emitter PATCHES to a CreateThread thunk (Linux path =
nx_thread_spawn/clone). This is the decisive test: does native MT bandwidth scale
past WSL2's ~9.5 GB/s pool plateau toward gcc's ~39 GB/s?
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_thread.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
| 14 | const BW_MAGIC_1048576: i64 = 1048576 |
| 16 | const BW_PER: i64 = 67108864 // 64MB per thread (> L3 slice -> DRAM-bound) |
| 17 | const BW_PASSES: i64 = 24 |
| 18 | const BW_NT: i64 = 16 // threads (box has 20 logical cores) |
functions
| 21 | func bw_worker(ctx: i64) -> i64 |
| 51 | func sys_thread_create(argptr: i64) -> i64 |
| 56 | func main() -> i64 |