ptab
A lock-free concurrent table for Rust.
ptab provides a fixed-capacity table optimized for read-heavy concurrent workloads. Inspired by Erlang's BEAM process table, lookups scale linearly with CPU count by avoiding all shared memory writes.
Features
- Zero-contention reads - Atomic loads for lock-free lookups.
- Cache-line distribution - Prevents false sharing with no memory overhead.
- Generational indices - Slot reuse mitigates ABA problems.
Usage
Add the following to your Cargo.toml:
[]
= "0.1"
Example
use PTab;
use Arc;
let table = new;
let handle = spawn;
let index_a = table.insert.unwrap;
let index_b = handle.join.unwrap;
assert_eq!;
assert_eq!;
Design
See IMPLEMENTATION.md for detailed design notes.