Async internals


Concurrency vs Paralleism

CPU-bound: Need to complete CPU processing to succeed

IO-Bound: Need to complete I/O requests to succeed

  • I/O Bounded tasks (tasks that needs to perform some kind of I/O, like read a file from disk) works better with concurrency.
    • Concurrency let us split all tasks that depends on I/O, for example:
      • The runtime start the execution of the file read operation (this usually depends on external routines and sometimes the hardware controllers itself, so it takes some time)
      • The runtime pauses the current task and move on to the next one.
      • The runtime resumes the paused task (that depends on I/O) when the requested reading operation is finished, and now, the task have the resources that it needs.
    • Notice that the idle time waiting for I/O operations to complete is overcomed.

Low-Level Concurrency in Practice

https://marabos.nl/atomics/

https://thomask.sdf.org/blog/2021/03/08/bridging-sync-async-code-in-rust.html

https://blog.logrocket.com/a-practical-guide-to-async-in-rust/

https://blog.yoshuawuyts.com/why-async-rust/

https://thomask.sdf.org/blog/2021/03/08/bridging-sync-async-code-in-rust.html

https://blog.yoshuawuyts.com/why-async-rust/


🌱 Back to Garden

1 item under this folder.