Very cool, Rust is something I really want to do some day. I am beyond sold! :D
This is very detailed, way more interesting facts than I was expecting.
I think many of the sections cover big enough topics that they could've been whole posts, so probably not an introduction level post. But personally I liked that, good to see some in-depth posts!
A RefCell is not threadsafe
Just to clarify for those less familiar with Rust: you can't actually do anything unsafe - you just can't share it between threads at all, it won't compile.
I tend to end up with RwLocks when doing threading code, not sure if that's a problem... Probably not super performance, but it's easy, and I like the way Rust ensures that you lock long enough but not too long.
I only found out after a while that RwLock exists and while less fair, is often faster than Mutex (which seems to be the most mentioned online). [By 'less fair' I mean that, in my understanding, it does not give equal chance to each thread... I think it can starves out writes?]
I wonder how hyperthreading diagram looks like 🤔
Michael Murphy
In addition to locking data structures like Mutex and RwLock, you should also mention channels like MPSC and MPMC. You may also want to mention ShardedLock from crossbeam, as well as its Parker and WaitGroup synchronization primitives. Rayon's thread pools and scoped threads are also very important to be aware of when dealing with threads in Rust.