parallel concurrent examples python

examples of parallelism, concurrency, and asyncio in python

29
15
Python

Parallelism, Concurrency, and AsyncIO in Python - by example

Speeding up CPU-bound and IO-bound operations with multiprocessing, threading, and AsyncIO

Blog post: Parallelism, Concurrency, and AsyncIO in Python - by example

Setup

  1. Fork/Clone
  2. Create and activate a virtual environment
  3. Install the dependencies

IO-bound Operation

$ python io-bound_sync.py
$ python io-bound_concurrent_1.py
$ python io-bound_concurrent_2.py
$ python io-bound_concurrent_3.py

CPU-bound Operation

$ python cpu-bound_sync.py
$ python cpu-bound_parallel_1.py
$ python cpu-bound_parallel_2.py