I'm looking for a writeup that provides guidelines for using Rust threads. I'd like to find answers to questions like these that I imagine most people new to Rust would have once they arrive at the need to use threads.
-
I see that I can use threads in Rust without using async_std or tokio. What are the needs of a program that would cause me to want to use those instead of just using what is built into Rust? Is it mostly the desire to use green threads (M:N) instead of native threads (1:1)?
-
Is it a problem if I call
std::thread::spawn
many more times than I have cores? It doesn't seem to be an issue. I tried it with 200 calls and all of them ran fine. -
The only runtimes I have encountered so far are async_std and tokio. Perhaps there are other lesser known options. Is it correct to say that currently for all practical purposes those are the only options?
-
I get the impression that tokio has more features than async_std. What are some guidelines for choosing between them or features that are present in one and not in the other?
Have you seen a writeup that addresses these questions?