The Aji RC11 profile (RC11 with NO-THIN-AIR; stronger than ISO C11/C++20) as normative axioms in spec 04 §20; DRF-SC; linear atomic<T> for AtomicScalar with atomic.new/atomic.take; ref<atomic<T>> operands; ordering tables incl. cmpxchg failure table and two results; effects [atomic] / [atomic, atomic.weak]; target atomic_widths and E4203; E4202; enumerator as oracle (observed ⊆ allowed, exact equality on the normative litmus corpus). Feature atomics stays reserved until P5-2a. Q-015 resolved; record/replay and Q-017 moved to Phase 8. RFC 0003 superseded. AIR bundle +1.9 %.
62 lines
1.7 KiB
Markdown
62 lines
1.7 KiB
Markdown
# RFC 0003: Concurrency Memory Model
|
|
|
|
Status: Superseded by RFC 0015
|
|
Target: Aji 0.1
|
|
|
|
## Summary
|
|
|
|
Aji adopts a data-race-free model for ordinary memory and explicit C/C++/Rust-style atomic ordering for low-level synchronization.
|
|
|
|
The intended user-level guarantee is DRF-SC:
|
|
|
|
> If a safe program has no data race, ordinary memory behaves as though operations occurred in some sequentially consistent interleaving consistent with happens-before.
|
|
|
|
## Relations
|
|
|
|
The model defines:
|
|
|
|
- sequenced-before;
|
|
- synchronizes-with;
|
|
- happens-before;
|
|
- atomic modification order.
|
|
|
|
## Synchronization examples
|
|
|
|
- operations before task spawn happen-before child start;
|
|
- child completion happens-before successful join return;
|
|
- channel send synchronizes with the matching receive;
|
|
- mutex unlock synchronizes with a later successful lock acquisition;
|
|
- release atomic operation synchronizes with an acquire operation that observes the release according to atomic semantics.
|
|
|
|
## Ordinary memory
|
|
|
|
Safe Aji rejects possible unsynchronized conflicting ordinary accesses.
|
|
|
|
The compiler may therefore optimize ordinary memory under the assumption that safe programs are race-free.
|
|
|
|
## Atomics
|
|
|
|
Orders:
|
|
|
|
```text
|
|
relaxed
|
|
acquire
|
|
release
|
|
acq_rel
|
|
seq_cst
|
|
```
|
|
|
|
No default order and no `consume`.
|
|
|
|
## Why no safe Atomic<ref<T>> initially
|
|
|
|
Publishing an address atomically does not solve reclamation. A verifier would need to reason about when pointed-to storage can be freed.
|
|
|
|
Therefore lock-free pointer structures should first exist behind audited library abstractions using epoch/hazard/RCU mechanisms.
|
|
|
|
## Weak-memory audit marker
|
|
|
|
Use of relaxed atomics should be visible in the effect/audit system as `atomic.weak`.
|
|
|
|
This has no runtime meaning; it is an auditability requirement.
|