Using three different modules: threading, multiprocessing and asyncio.
3
Break down the problem.
4
Before we begin...
5
Before we parallelise...
6
Sequential Approach
7
Actual real POSIX threads (pthreads) or Windows threads.
8
threading example to multiprocessing...
9
Convenient means of parallelising the execution of a function across multiple input values, distributing the input data across processes (data parallelism).
10
sequential example to multiprocessing...
11
Provides infrastructure for writing single- threaded concurrent code.
12
Basic asynio Concepts
13
The component that is in charge of keeping track of and scheduling all the coroutines that want time on the thread.
14
Drum roll
Description:
Explore a comparative analysis of parallelism techniques in Python through this conference talk from EuroPython 2015. Dive into the mechanics and benchmarks of three different approaches to handling multiple URL downloads: using threads, multiple processes, and asyncio. Learn how to implement each method using the threading, multiprocessing, and asyncio modules. Understand the concepts of POSIX threads, data parallelism, and coroutines. Gain insights into breaking down parallelism problems, sequential approaches, and the basics of asyncio. Discover which technique performs best for handling concurrent I/O-bound tasks in Python.
Parallelism Shootout - Threads vs Asyncio vs Multiple Processes