OverLab Non-Waiting Paradigm (NWP) - The next generation of modern concurrency
Source: Dev.to
What is the Non‑Waiting Paradigm (NWP)?
The Non‑Waiting Paradigm (NWP) enables a program to continue executing without blocking while spawning lightweight execution units for each reference (function, variable, macro, class, namespace, etc.). These units—implemented as actors, green threads, or fibers—process data in parallel. When the main program finishes, the branches merge back, committing their results. If some branches are still running, the runtime enters a controlled Non‑Waiting Loop (NWL) until they complete, then merges them seamlessly.
How It Works
- Main program runs as usual.
- Every new reference spawns a Branch (lightweight actor/green thread/fiber).
- The main program continues forward without waiting for branch results.
- Branches process data in parallel.
- At program completion, branches merge back into the main program, injecting their results.
- If any branches are unfinished, the runtime enters a Non‑Waiting Loop (NWL) until they finish, then performs the merge.
Generations of NWP
First Generation
- Green Threads / Fibers for branches
- Atomic variables & memory fences for safe data access
- NWL (Non‑Waiting Loop) for controlled completion
Main Generation
- HCR Scheduler – schedules branches
- Branch Unit (BU) – ultra‑light execution unit (lighter than fibers/threads)
- Commit Engine – injects data after main completes
- Branch Lifecycle Manager – manages branch creation, execution, and cleanup
- NWDC (Non‑Waiting Data Channel) – zero‑wait data transfer
Sub‑Paradigms (Categories of NWP)
Branch‑Oriented
- Each reference → independent branch
- True concurrency; main never stops
- High runtime complexity, but very fast
- Ideal for real‑time systems, heavy processing, responsive UIs
Ignore‑Oriented
- References are ignored until program end
- No concurrency, but very simple
- Fast main execution; sequential processing later
- Suitable for lightweight scripts and simple apps
Locking Non‑Waiting
- References ignored until end, then program freezes to process them
- Ensures strict consistency
- Best for systems where final correctness outweighs responsiveness
App‑Oriented
- Each reference → separate process
- Concurrency via multi‑process execution
- Strong isolation, higher resource usage
- Best for distributed systems, sandboxing, high‑security apps
Why NWP Matters
- Main execution speed: near‑maximum, no blocking
- Concurrency: real, lightweight, scalable
- Flexibility: multiple sub‑paradigms for different needs
- Future‑proof: designed for real‑time, UI, distributed, and heavy workloads
Current Status
- Stable v1.0 release is production‑ready
- Roadmap for future generations already defined
License
The project is released under an open‑source license. The source will become publicly available once the community signals readiness.