code wiki / (root) / nx_ppdemo_threads.nx

nx_ppdemo_threads.nx

buildroot/runtime/nx_ppdemo_threads.nx

1888 B49 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic ppdemo
docsdependenciesstructsconstsfunctions

about

nx_ppdemo_threads.nx -- REAL multi-core proof via raw __thread_clone (stage-1 func-pointers). Spawns 4 worker threads, each doing a heavy data-dependent LCG loop (not DCE-able); main does the same. 5 compute streams sharing ONE process (CLONE_VM) -> if they run in parallel, nx_parallelism_probe reads cpu/wall ~5 (vs the serial demo's 1.00). This is the codec unlock made measurable. Build with the func-ptr compiler.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_ppdemo_threads.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sys_exit

structs

none

consts

6const K_MAGIC_1103515245: i64 = 1103515245
7const K_MAGIC_12345: i64 = 12345
8const K_MAGIC_2147483647: i64 = 2147483647
9const K_MAGIC_262144: i64 = 262144
10const K_MAGIC_5000000000: i64 = 5000000000
12const NTHREAD: i64 = 4
13const ITERS: i64 = 1500000000

functions

15func hot(ctx: *u8) -> i64
25func main() -> i64