code wiki / (root) / nx_parexec.nx

nx_parexec.nx

buildroot/runtime/nx_parexec.nx

8989 B209 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_parexec.nx -- ACTUAL PARALLEL multi-core execution (closes distributed-compute's last blocked half). The "1-core threading gap" was inherited, not measured: nx_syscalls has had sys_fork/sys_wait4/ sys_mmap_shared all along (hundreds of organs fork; nx_arbiter_race_gate proves shared-sink races). So the distexec partition->merge algebra runs for REAL in parallel: the parent allocates a SHARED result region, forks one child PER PARTITION (the kernel schedules them across cores), each child computes its partition's partial into its OWN shared slot (disjoint writes => no locks needed), the parent wait4()s all and merges. From the first byte up: raw fork, no pthreads, no libc, no shell. Correctness is byte- identical to the sequential run (same algebra); the win is wall-clock, MEASURED live on the box's cores. license_tier: ORIGINAL No hardware writes (Rule 26).

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_colframe.nx nx_distexec.nx nx_parexec.nx nx_parexec_gate.nx

imports: nx_syscalls.nxnx_colframe.nxnx_distexec.nx

imported by: nx_parexec_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap pe_atoi pe_bench sys_mmap ↻ cf_encoded_bytes cf_slen cf_align8 cf_encode cf_align8 ↻ sys_now_us sys_mmap ↻ sys_clock_gettime_mono de_run_agg cf_nrows sys_mmap ↻ de_bound de_agg_range cf_col cf_data_off de_merge pe_agg_parallel cf_nrows ↻ sys_mmap_shared sys_mmap ↻ de_bound ↻ sys_fork de_agg_range ↻ sys_exit sys_wait4 de_merge ↻ pe_hash_range cf_col ↻ pe_hash_parallel cf_nrows ↻ sys_mmap_shared ↻ sys_mmap ↻ de_bound ↻ sys_fork ↻ pe_hash_range ↻

structs

none

consts

13const PE_MAGIC_1103515245: i64 = 1103515245
14const PE_MAGIC_12345: i64 = 12345
15const PE_MAGIC_4242: i64 = 4242
16const PE_MAGIC_100000: i64 = 100000
17const PE_MAGIC_20000000: i64 = 20000000
19const PE_OUT: i64 = 8192
20const PE_ZERO: i64 = 48
21const PE_MAXP: i64 = 64

functions

24func pe_agg_parallel(frame: *u8, ci: i64, P: i64, out4: *i64) -> i64
74func pe_hash_range(frame: *u8, ci: i64, lo: i64, hi: i64) -> i64
called by 2: pe_hash_parallelpe_bench calls 1: cf_col
88func pe_hash_parallel(frame: *u8, ci: i64, P: i64) -> i64
117func pe_raw(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o }
called by 1: pe_bench
118func pe_num(out: *u8, o: i64, v: i64) -> i64
called by 1: pe_bench calls 1: sys_mmap
130func pe_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; var go: i64 = 1; while go == 1 { let c: i64 = s[i] as i64; if c < 48 { go = 0 } else { if c > 57 { go = 0 } else { v = v * 10 + (c - 48); i = i + 1 } } } return v }
called by 1: main
132func pe_bench(nrows: i64, P: i64, out: *u8) -> i64
198func main(argc: i64, argv: *i64) -> i64