Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Rundown of Async/Await in Rust

Asynchronous programming is a method of programming that can allow multiple different things to be run concurrently (or in parallel). In Rust, it is accomplished using a high-level idea called a Future.

Asynchronous programming is used a lot for IO because there are many times where you have to wait for something to happen (such as reading from a socket or a file) during which no progress can be made. This is a perfect moment to hand over control to something else so that it can start to make progress. This allows our program to always be making progress, which is the name of the game.

Go through this slides, where Pawan Bisht will be talking about the asynchronous concept in Rust Programming like what operations performed by the Rust compiler that actually makes our code asynchronous and what's the role of waker, poll, etc. With this, you can increase your software/application's performance and responsiveness.

  • Inicia sesión para ver los comentarios

Rundown of Async/Await in Rust

  1. 1. Rundown of Async/Await Presented By: Pawan Singh Bisht Software Consultant Knoldus Inc.
  2. 2. About Knoldus Knoldus is a technology consulting firm with focus on modernizing the digital systems at the pace your business demands. Functional. Reactive. Cloud Native
  3. 3. What is Asynchronous programming? Our Agenda 1 05 3 7 4 6 5 8 2 9 10 Alternatives for handling concurrent programming Internals & Workflow Rust vs. Go Rust Future Rust Future: Internal Execution Executor & Reactor Rust Future: Internal Execution (Quick Demo) async/.await: Quick Intro async/.await: Quick Demo
  4. 4. What is Asynchronous programming? Asynchronous programming is a concept which allows multiple things to happen at the same time. ● Parallel ● Concurrent ● Asynchronous
  5. 5. Parallel ● Parallelism is about doing a lot of things at the same time. ● Can be achieved only on multi cores. Concurrent ● Concurrency is about dealing with a lot of things at the same time. Asynchronous ● Asynchrony is used to present the impression of concurrent or parallel tasking.
  6. 6. Alternatives for handling concurrent programming ● Threads provided by the operating system : OS Threads ● Green threads
  7. 7. OS Threads (Native) New OS thread for each task. Pros: ● Easy to use ● Switching between tasks is reasonably fast Cons: ● OS level threads come with a rather large stack. ● Could go out of memory if you have many tasks waiting simultaneously. ● Can be costly when the number of tasks are high.
  8. 8. Green Threads Green threads are user level threads rather than kernel level threads. Includes context switching Pros: ● Light Weight ● Context switch" is reasonably fast. Cons: ● Not a zero cost abstraction ● You need to save the CPU state on every switch.
  9. 9. async/.await: Quick Intro Built-in tool of Rust Programming for writing asynchronous functions. Async: Transforms a block of code into a state machine that implements a trait called Future. Await: Mechanism to run a Future. It asynchronously waits for the future to complete.
  10. 10. async ‘async’ transforms a block of code into a state machine that implements a trait called Future. Two ways to use async: async fn and async blocks. Each returns a value that implements the Future trait.
  11. 11. async Using async keyword with function Using async block inside function
  12. 12. .await Asynchronously waits for the Future to complete Inside async fn Inside async block
  13. 13. async/.await Quick Demo…
  14. 14. Internals & Workflow
  15. 15. Rust vs. Go In terms of: ● Syntax ● Type ● Runtime
  16. 16. Rust vs. Go
  17. 17. Rust Future ● Representation of some operation which will complete in the future. ● Zero-cost futures
  18. 18. Rust Future: Basic
  19. 19. Rust Future
  20. 20. Rust Future : Internal Execution
  21. 21. Executor & Reactor
  22. 22. Rust Future Quick Demo…
  23. 23. Go to Website
  24. 24. References ● https://docs.rs/futures/0.3.12/futures/ ● Understanding Futures In Rust ● Futures in Rust
  25. 25. Thank You! @pawan.bisht@knoldus.com @pawan-bisht-b70bb87a @pawanbisht62

×