What is ForkUnion?
mainForkUnion is a NUMA-aware fork-join thread-pool designed for high-performance parallel loops (similar to #pragma omp parallel for). Unlike traditional task-queue runtimes, it is optimized for low-latency dispatch in high-core-count environments.
Key Characteristics:
- Performance: Designed to minimize the 'fork-join tax'. It is significantly faster than OpenMP, Rayon, and Taskflow for parallel-for dispatches.
- Zero Overhead on Hot Path: Makes zero heap allocations, zero system calls, and zero CAS (Compare-And-Swap) operations during execution. It avoids cache-line false-sharing.
- Hardware-Level Parking: Uses hardware address monitors (e.g., x86
UMONITOR/UMWAIT, ArmWFET, RISC-VZawrs) to allow idle workers to light-sleep on specific cache-lines, waking instantly upon a write without hot spinning or kernel futexes. - Scalability: Maintains flat dispatch latency even into hundreds of cores by using private
fetch_addcursors to avoid interconnect thrashing on multi-socket systems. - Portability: Runs on Linux, FreeBSD, Windows, macOS, Android, and iOS. Supports asymmetric compute and memory topologies.