Concurrent Execution Articles

_thread — Low-level threading API

This module provides low-level primitives for working with multiple threads (also called light-weight processes or tasks) — multiple threads of control sharing their global data space. For synchronization, simple locks (also called mutexes or binary semaphores) are provided. The threading module provides an easier to use and higher-level threading API built on top of this module.

concurrent.futures — Launching parallel tasks

Source code: Lib/concurrent/futures/thread.py and Lib/concurrent/futures/process.py

contextvars — Context Variables

This module provides APIs to manage, store, and access context-local state. The ContextVar class is used to declare and work with Context Variables. The copy_context() function and the Context class should be used to manage the current context in asynchronous frameworks.

multiprocessing — Process-based parallelism

Source code: Lib/multiprocessing/

multiprocessing.shared_memory — Provides shared memory for direct access across processes

Source code: Lib/multiprocessing/shared_memory.py

queue — A synchronized queue class

Source code: Lib/queue.py

sched — Event scheduler

Source code: Lib/sched.py

subprocess — Subprocess management

Source code: Lib/subprocess.py

The concurrent package

Currently, there is only one module in this package:

threading — Thread-based parallelism

Source code: Lib/threading.py