Chapter 4. Asynchronous Programming

In this chapter, we will cover the following recipes:

  • How to use the concurrent.futures Python module
  • Event loop management with Asyncio
  • Handling coroutines with Asyncio
  • Task manipulation with Asyncio
  • Dealing with Asyncio and Futures

Introduction

With the sequential and parallel execution model, there is a third model, called the asynchronous model, that is of fundamental importance to us along with the concept of event programming. The execution model of asynchronous activities can be implemented using a single stream of main control, both in uniprocessor systems and multiprocessor systems.

In the asynchronous model of a concurrent execution, various tasks intersect with the timeline, and all of this happens under ...

Get Python Parallel Programming Cookbook 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.