4 ms·
> Rust probably won’t allow me to implement a couple of lockless parallel algorithms I have implemented in my Ph.D. Why? Can you be more specific? Rust has bui
by kouteiheika 3y ago
> Rust probably won’t allow me to implement a couple of lockless parallel algorithms I have implemented in my Ph.D.
Why? Can you be more specific? Rust has built-in support for atomics and essentially the same memory model as C++, e.g.:
https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU32.html https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU32.h...
And you can sidestep essentially any requirements of normal Rust using an `UnsafeCell` (e.g. that's how mutexes are implemented, with an `UnsafeCell` holding the data and an atomic).
I've written my share of lockless algorithms and I haven't really noticed any deficiency compared to C++, but then, I'm not an expert in this area, so if there is a deficiency here I'd love to hear about it.