Learning rust with entirely too many linked lists (2019)
rust-unofficial.github.io
rust-unofficial.github.io
> You're doing some awesome lock-free concurrent thing.
Here's an actual example of an "awesome lock-free concurrent thing" that indeed needs linked lists, Jon Gjengset re-implementing (most of) Folly's Hazard Pointers but in Rust and he eventually checks they work correctly and have decent performance:
https://www.youtube.com/playlist?list=PLqbS7AVVErFgO7RUIC6lh...
Unlike the "too many linked list" stuff this is not a Rust tutorial and you should not try to learn Rust by following how this is done. But if you know Rust pretty well it's a pretty interesting watch. This is definitely past the point where safe Rust is enough to get work done. Rust has no idea why hazard pointers could be OK, so Jon will be responsible for delivering Rust's fabled safety in his implementation any time he needs to write "unsafe" - or else everything catches fire. I think it might also be interesting for C++ programmers who know how Folly's Hazard Pointers work and would like to just see what Rust looks like when used on real problems rather than starting with Hello World and the Fibonacci numbers.
[1] https://twitter.com/Gankra_/status/1486928208528293888 [2] https://github.com/rust-lang/miri
Backlinks as weak links work. It's not symmetrical, but it's sound. Forward links then must be Rc<RefCell<T>> links, while backlinks are Rc<Weak<T>>.
This also generalizes to the thread safe form, Arc<Mutex<T>>.
My favourite formats to learn from are the "learn while you build" types where you get a good combination of the "how" and the "why," which this seems to be doing.
I really appreciate this being shared! Thanks to the authors for writing the book and OP for bringing it to my attention here on YC <3
edit: and if anyone else has suggestions of similar resources I'd love to hear about those too :D
Just like you, I do prefer the "learn while you build" approach. My personal experience has been that the book is a nice addition to reference-style books, such as the one you mentioned.
1: https://www.oreilly.com/library/view/command-line-rust/97810...
I also really liked Rust in Action, and then once you’ve got some experience under your belt, Rust for Rustaceans.