External Publication
Visit Post

Idea : Lock Free STD Collection

Rust Internals [Unofficial] March 6, 2026
Source

The problem with lock-free data structures is that they typically require lock-free memory reclamation, unless they have some very specific access constraints (cf. tokio::mpsc). Java does not have this problem because of GC. There is generally no single memory reclamation scheme that is "optimal" for all data structures, either. Also, using a single global memory reclaimer (like crossbeam-epoch) leads to simpler data structure APIs, but is not ideal for performance, especially if used by different lock-free data structure instances that are logically unrelated.

So std would not only have to provide the lock-free data structures but also either a single memory reclamation mechanism implementation used by all or design something like a generic trait-based reclamation API, which is not really something that has been seriously attempted thus far. Given that Rust does not even have a stable Allocator API (which is basically a solved issue) I seriously doubt anyone would want to commit to something like this.

Discussion in the ATmosphere

Loading comments...