Note While I use 12 cores, you should use the number of cores on your machine. If we increase this…
Summary – Runtimes, Wakers, and the Reactor-Executor Pattern
Note While I use 12 cores, you should use the number of cores on your machine. If we increase this number too much, our OS will not be able to […]
Read MoreAn example using concurrency – Runtimes, Wakers, and the Reactor-Executor Pattern
Experimenting with our new runtime If you remember from Chapter 7, we implemented a join_all method to get our futures running concurrently. In libraries such as Tokio, you’ll find a […]
Read MoreImplementing a proper Reactor – Runtimes, Wakers, and the Reactor-Executor Pattern-3
The first thing we do is give HttpGetFuture an identity. It’s the source of events we want to track with our Reactor, so we want it to have the same […]
Read MoreImplementing a proper Reactor – Runtimes, Wakers, and the Reactor-Executor Pattern-2
Now that our Reactor is set up, we only have two short functions left. The first one is event_loop, which will hold the logic for our event loop that waits […]
Read MoreImplementing a proper Reactor – Runtimes, Wakers, and the Reactor-Executor Pattern-1
The final part of our example is the Reactor. Our Reactor will: When we’re done with this step, we should have everything we need for our runtime, so let’s get […]
Read MoreA QUICK NOTE ABOUT STATIC LIFETIMES – Runtimes, Wakers, and the Reactor-Executor Pattern-2
block_on will be the entry point to our Executor. Often, you will pass in one top-level future first, and when the top-level future progresses, it will spawn new top-level futures […]
Read MoreA QUICK NOTE ABOUT STATIC LIFETIMES – Runtimes, Wakers, and the Reactor-Executor Pattern-1
When a ‘static lifetime is used as a trait bound as we do here, it doesn’t actually mean that the lifetime of the Future trait we pass in must be […]
Read MoreImplementing a proper Executor – Runtimes, Wakers, and the Reactor-Executor Pattern-2
ExecutorCore holds all the state for our Executor: ExecutorCore derives the Default trait since there is no special initial state we need here, and it keeps the code short and […]
Read MoreImplementing a proper Executor – Runtimes, Wakers, and the Reactor-Executor Pattern-1
In this step, we’ll create an executor that will: Note It’s worth mentioning that our executor won’t be fully multithreaded in the sense that tasks/futures can’t be sent from one […]
Read MoreChanging the Future definition – Runtimes, Wakers, and the Reactor-Executor Pattern
How does this Waker compare to the one in the standard library? The Waker we create here will take the same role as the Waker type from the standard library. […]
Read More