As a library providing several synchronization primitives, Asyncband relies on atomic state transitions, waiter queues, and wake-up handling. Conventional unit and stress tests exercise many concurrent schedules, but they cannot systematically explore every relevant execution ordering. Rare interleavings may therefore hide missed wake-ups, leaked ownership, deadlocks, or invalid state transitions.
Loom provides deterministic model checking for concurrent Rust code. Small, focused models can systematically explore relevant interleavings and validate invariants such as:
- Readers and writers never holding incompatible ownership
- Waiter publication racing with lock release without missing a wake-up
- Cancellation before or after ownership is granted
- Queue-head cancellation preserving follower progress
- Atomic upgrade and downgrade transitions
- Correct memory ordering between lock holders
Loom can only explore concurrency performed through its own instrumented primitives. Every atomic, mutex, thread, cell, or other synchronization operation relevant to a model must therefore use the corresponding Loom type. Any synchronization left using an uninstrumented std type falls outside Loom’s scheduler and reduces the model’s coverage, however, this is for the most part covered by the existing test infrastructure. Asyncband would use conditional compilation to select Loom primitives during model checking and the existing std implementations in normal production builds.
A working draft has been added to the RwLock changes (here), where the previous semaphore-based implementation was replaced with a purpose-built atomic scheduler. The draft model-checks ownership exclusion, waiter publication, cancellation around grant, queue progress, upgrade priority, and downgrade handoff.
If the project decides not to adopt Loom, the draft can be removed from the RwLock PR before merging. If adopted, support can be expanded through separate, individual PRs for other synchronization internals, such as:
- Semaphore
- AtomicOptionBox
- Mutex scheduling
- Countdown and wait-set primitives
- Channel state machines
The models should remain small and bounded to keep CI execution practical. Loom would exist only to complement the existing unit, integration, stress, and multithreaded tests.
As a library providing several synchronization primitives, Asyncband relies on atomic state transitions, waiter queues, and wake-up handling. Conventional unit and stress tests exercise many concurrent schedules, but they cannot systematically explore every relevant execution ordering. Rare interleavings may therefore hide missed wake-ups, leaked ownership, deadlocks, or invalid state transitions.
Loom provides deterministic model checking for concurrent Rust code. Small, focused models can systematically explore relevant interleavings and validate invariants such as:
Loom can only explore concurrency performed through its own instrumented primitives. Every atomic, mutex, thread, cell, or other synchronization operation relevant to a model must therefore use the corresponding Loom type. Any synchronization left using an uninstrumented std type falls outside Loom’s scheduler and reduces the model’s coverage, however, this is for the most part covered by the existing test infrastructure. Asyncband would use conditional compilation to select Loom primitives during model checking and the existing std implementations in normal production builds.
A working draft has been added to the
RwLockchanges (here), where the previous semaphore-based implementation was replaced with a purpose-built atomic scheduler. The draft model-checks ownership exclusion, waiter publication, cancellation around grant, queue progress, upgrade priority, and downgrade handoff.If the project decides not to adopt Loom, the draft can be removed from the
RwLockPR before merging. If adopted, support can be expanded through separate, individual PRs for other synchronization internals, such as:The models should remain small and bounded to keep CI execution practical. Loom would exist only to complement the existing unit, integration, stress, and multithreaded tests.