Concurrent Event Simulation Engine
Orchestrating thousands of simultaneous processes into coherent outcomes. Built for precision. Engineered for scale.
CompletEngine uses a lock-free event loop with work-stealing schedulers to achieve near-linear scalability across cores. The architecture separates event sourcing from process execution, enabling deterministic replay of concurrent simulations.
Lock-free ring buffer processes events in arrival order. Each event is tagged with a logical timestamp for causal ordering across distributed nodes.
engine.loop(events, scheduler: .workStealing)
Barrier-based synchronization ensures all threads reach consistent state before advancing. Configurable sync granularity from per-tick to per-epoch.
barrier.sync(threads, granularity: .tick)
Real-time cycle detection in the resource dependency graph identifies deadlocks within one tick. Automatic resolution via priority-based preemption.
detector.watch(graph, resolve: .preempt)
Performance measured on AMD EPYC 9654 (96 cores), 384GB DDR5. All benchmarks run with deterministic seeding for reproducibility.
Core types and methods for configuring and running concurrent simulations.
The primary simulation engine. Manages thread pools, event queues, and synchronization barriers.
let engine = Engine::new(Config {
threads: 96,
scheduler: Scheduler::WorkStealing,
sync_granularity: Granularity::Tick,
deadlock_detection: true,
});
Execute a simulation with the given event stream. Returns a deterministic result that can be replayed.
let result = engine.run(events)?;
assert_eq!(result.checksum(), expected_checksum);
Synchronize all threads at a barrier point. Blocks until all threads have reached the barrier.
let sync = barrier.sync(&active_threads)?;
match sync.status {
SyncStatus::Complete => continue,
SyncStatus::Timeout(d) => handle_timeout(d),
}
Get a concurrent simulation running in under five minutes.
cargo add completengine
let config = Config::default()
.threads(num_cpus::get())
.scheduler(Scheduler::WorkStealing);
let events = EventStream::from_iter(
(0..10_000).map(|i| Event::new(i, payload))
);
let engine = Engine::new(config);
let result = engine.run(events)?;
println!("Processed {} events in {:?}",
result.count(), result.elapsed());