Multithreading, why does everyone always do it wrong? One of life's big questions.
Local async executors and why they should be the default
11–20 of 327 posts
Re: Local async executors and why they should be the default
#12Re: Local async executors and why they should be the default
#13> Posted on June 9, 2022
Yeah, it is old. But I only found it recently and did not see a discussion of it yet. I found this quite interesting. I love rust, but async rust always seems almost like a different language. Lifetimes become much more complex and much less useful, you use Box and Arc way too much. It seems like you would be better off if everything was heap allocated. Working with local futures brings back some of the things I love…
> this is old
???
Re: Local async executors and why they should be the default
#14The only reason all this async stuff even exists is because we want concurrency. We want to say "while this one task waits for I/O, this other task will do stuff". So it's not too surprising to me that an intro to async would include synchronization primitives. Those primitives aren't really "thread"-specific if by thread you mean OS thread. When you do async like this, you're basically re-implementing OS threads in user space.
Re: Local async executors and why they should be the default
#15Re: Local async executors and why they should be the default
#16"If you write regular synchronous Rust code, unless you have a really good reason, you don't just start with a thread-pool. You write single-threaded code until you find a place where threads can help you, and then you parallelize it, [..]" I cannot agree more with that. As someone who's done a good deal of Java in my day job, I can tell you a thing or two about spawning threads willy-nilly. At least it is easier to…
Re: Local async executors and why they should be the default
#17> Yes the RwLock and mpsc comes from Tokio and lets you .await instead of blocking a thread, but these are not async primitives, these are multi-threading synchronization primitives. The only reason all this async stuff even exists is because we want concurrency. We want to say "while this one task waits for I/O, this other task will do stuff". So it's not too surprising to me that an intro to async would include syn…
Which lets be honest, is something green threads desperately needed.
Re: Local async executors and why they should be the default
#18Don't do that.
Edit: Thanks to the mods or whoever fixed it.
Re: Local async executors and why they should be the default
#19Re: Local async executors and why they should be the default
#20> Yes the RwLock and mpsc comes from Tokio and lets you .await instead of blocking a thread, but these are not async primitives, these are multi-threading synchronization primitives. The only reason all this async stuff even exists is because we want concurrency. We want to say "while this one task waits for I/O, this other task will do stuff". So it's not too surprising to me that an intro to async would include syn…