Concurrent Event Simulation Engine
Orchestrating parallel execution across distributed event streams.
· ·
The concurrent event engine operates on a fork-join execution model. Each incoming event spawns a lightweight thread that traverses a directed acyclic graph of handlers. When a handler requires parallel decomposition, it forks the current thread into N child threads — each pursuing an independent execution path through the handler graph.
Thread scheduling is non-preemptive. Once a thread acquires a handler lock, it executes to completion or to the next fork point — whichever comes first. This guarantees deterministic ordering within a single execution branch while permitting genuine concurrency across branches.
When two threads attempt concurrent writes to the same state region, a conflict is detected at the merge point. The engine employs a last-writer-wins strategy with causal ordering — the thread whose fork point has a higher Lamport timestamp takes precedence.
The engine provides exactly-once delivery semantics within a single simulation epoch. Events are deduplicated at the ingestion boundary using content-addressed hashing — identical events arriving from multiple sources are collapsed into a single thread root. The Lamport clock ensures causal consistency across all fork-join boundaries.
Each thread operates on a copy-on-write snapshot of the global state. Writes are buffered in a thread-local journal until the join point, where the engine performs a three-way merge between the parent state, thread_α journal, and thread_β journal. Conflicts are resolved by timestamp ordering.
The merge operation is atomic. If any conflict cannot be resolved deterministically, the entire epoch is rolled back and re-executed with conflict-avoidance hints injected into the fork scheduler.
Under nominal load, the engine sustains 2.4M events/sec on a 16-core topology with 99.97% fork-join completion rate. Thread contention peaks at 12-14% under adversarial workloads — the scheduler adaptively reduces fork depth when contention exceeds the configurable threshold.
concengine — concurrent event simulation at depth. Every thread is a hypothesis. Every join is a proof.