What are the difference and appropriate usage of these thread related libraries


I have only used the std::thread package from the standard library, but there seems to be many different related implementation of threads

There is crossbeam.


Scoped threadpool


There seems to be too little explanations on each README of each project too.
If you have used any of these projects, can you please give an appropriate usage of these.


Hi ivanceras,

I’ve used some of these in my mandelbrot test:


The idea is to show how to use these different crates. In the future I want to add more (Rayon, ArrayFire, …).

Hope this helps, if you have more questions post them here!


There is also this one: https://github.com/nikomatsakis/rayon
From @nikomatsakis. What is nice about it is that it implements potential parallelism(a la C++11 std::async).


Rayon has good documentation. I wish other libraries writes out even just an overview of the library.


By the way, on the topic of Rayon, I haven’t had as much time to work on it as I would like, but I finally got around to putting in a bit more effort this morning. In particular there are two pending PRs (#23 and #24) that significantly expand the par-iter API and clean it up.


My summary of when rayon is a good choice is: when you have a for loop (or recursive fn) that takes too long. In particular, it is ill-suited to asynchronous execution, for which you would want a more future-like interface (but which would also prevent you from using data on the stack, or at least require something like crossbeam’s scoped threads; simple-parallel offers some nice features for those cases).


Also, you may be interested in the video from this recent bay area Rust meetup, where @aturon, @huon and I talked about crossbeam, simple-parallel, and rayon respectively: