Introduction to asynchronous programming

If you want to achieve high performance in computing, you will need to run tasks concurrently. Whether you are running complex computations that take days, such as machine learning training, or you are running a web server that needs to respond to thousands of requests per second, you will need to do more than one thing at the same time.

Thankfully, as we have already seen, our processors and operating systems are prepared for concurrency, and in fact, multithreading is a great way to achieve it. The main issue is that as we saw in the previous chapter, we should not be using more threads than logical CPUs in our computer.

We can, of course, but some threads will be waiting for others to execute, and ...

Get Rust High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.