A lock-free, wait-free, continuation-stealing tasking library for C++20 built on coroutines, enabling ultra-fine-grained parallelism.
libfork is a C++20 tasking library that implements strict fork-join parallelism using coroutines. It provides a lock-free, wait-free, continuation-stealing runtime for writing highly concurrent tasks with minimal overhead. The library solves the problem of achieving fine-grained parallelism in C++ without relying on traditional threading primitives.
C++ developers building high-performance parallel applications, such as numerical computing, simulation, or game engines, who need efficient task scheduling with low overhead.
Developers choose libfork for its ultra-low task spawning overhead, NUMA-aware schedulers, and strict fork-join model that ensures safety and scalability. It outperforms libraries like OneTBB, OpenMP, and TaskFlow in both speed and memory efficiency.
A bleeding-edge, lock-free, wait-free, continuation-stealing tasking library built on C++20's coroutines
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses a cactus stack with segmented stacks for almost non-allocating task spawning, enabling fine-grained parallelism with overhead as low as 10x a bare function call, per benchmarks.
Lock-free and wait-free design with continuation stealing ensures non-blocking execution and linear scaling across many cores, as demonstrated in performance comparisons.
Includes optimized schedulers like lazy_pool and busy_pool for NUMA systems, providing portable performance improvements on modern multi-core hardware.
Zero dependencies and full CMake support, available via package managers like vcpkg and Conan, simplifying adoption in existing projects.
Exception safety requires manual management, such as wrapping code in try-catch and calling stash_exception, which is error-prone and violates RAII principles.
Demands deep understanding of C++20 coroutines, strict fork-join semantics, and library-specific patterns like lf::eventually, making it inaccessible for casual users.
Bans certain reference conversions to prevent dangling pointers, but this can complicate API usage and lead to subtle bugs if not carefully followed.
As a niche library, it lacks the community tools, extensive documentation, and third-party integrations found in established alternatives like Intel TBB.