AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
The Differences Between Green Threads and Async Rust
With Async Rust, you have the concept of a task and that is similar in idea to a thread or to a co-routine. But with Async await, you can write your logic in a like step-by-step one like kind of way. The compiler at compile time it will take that kind of almost synchronous logic and rewrite it to be a state machine. Like once it's compiled to the state machine, then Tokyo or any other AC runtime can take all of these tasks and the scheduler can execute them on a single thread.