From the course: Faster Python Code

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

asyncio

asyncio - Python Tutorial

From the course: Faster Python Code

Start my 1-month free trial

asyncio

- [Instructor] Both thread and processes are great tools for pryo computing. However, there are cases when we need a lot of work units. And both threads and processes are too much. Spinning thousands of threads or process on a single machine will usually bring it to its knees. If you're I/O-bound, we also have the option of asyncio, which stands for asynchronous input/output. To understand how asyncio works, we first need to understand the difference between concurrency and parallelism. To steal from World Pike, concurrency is about dealing with a lot of things at once. Parallelism is about doing a lot of things at once. For example, in the old days I had on call on one CPU. And still managed to run several programs at once. The processor gave each process some times to run and then switched to another process. Asyncio works in a similar way, however, instead of stopping each work unit, known as a task, at a time interval…

Contents