Exploring high-level concepts of tokio
There is some contention about this, but tokio is the main async runtime that web frameworks run on. Unlike our single threaded async queue, tokio has multiple threads with task stealing as seen in figure 3.2.
![Figure 3.2 – Speeding up the Tokio runtime [Source: Tokio Documentation (2019) ( https://tokio.rs/blog/2019-10-scheduler )]](https://static.packt-cdn.com/products/9781835887769/graphics/media/file17.png)
Here, we can see that the tokio runtime has multiple worker threads that all have their own queues. On top of multiple workers, tokio also implements "task stealing". This is where the worker will steal a task from another queue if that worker does not have its own tasks to process. In the first section of this chapter, we used tokio to display some functionality of async runtimes. However, we restricted the number of worker threads to one to avoid the task stealing from masking how blocking works. We can see that our simple implementation of an async task queue does not really match up to the full features...