Concurrency
Concurrency System
Section titled “Concurrency System”EntropyCore provides a high-performance, lock-free concurrency system based on Work Contracts and Distributed Contention.
Key Concepts
Section titled “Key Concepts”- Work Contracts: Light-weight, atomic units of work.
- Work Groups: Isolated pools of work contracts (e.g., Physics, Rendering).
- Work Service: The execution engine that manages worker threads and scheduling.
- Lock-Free: Designed to scale with core count without mutex contention.
Architecture
Section titled “Architecture”For a deep dive into how the system works, including the Signal Tree and Scheduling logic, please see the Architecture documentation:
- Work Contracts: The atomic unit and lock-free mechanism.
- Work Graphs: Managing dependencies and DAGs.
- Work Service: The scheduler and engine.
Quick Usage
Section titled “Quick Usage”// 1. Get the WorkServiceauto& app = EntropyApplication::shared();auto workService = app.services().get<WorkService>();
// 2. Define a groupWorkContractGroup physicsGroup(4096, "Physics");
// 3. Register with serviceworkService->addWorkContractGroup(&physicsGroup);
// 4. Create workauto handle = physicsGroup.createContract([]() { performPhysicsStep();});
// 5. Schedulehandle.schedule();