The modules described in this chapter provide support for concurrent execution of code. The appropriate choice of tool will depend on the task to be executed (CPU bound vs IO bound) and preferred style of development (event driven cooperative multitasking vs preemptive multitasking). Here’s an overview:
threading — Thread-based parallelism multiprocessing — Process-based parallelismmultiprocessing.shared_memory — Shared memory for direct access across processesconcurrent packageconcurrent.futures — Launching parallel tasks concurrent.interpreters — Multiple interpreters in the same process subprocess — Subprocess management sched — Event scheduler queue — A synchronized queue class contextvars — Context Variables The following are support modules for some of the above services:
© 2001–2025 Python Software Foundation
Licensed under the PSF License.
https://docs.python.org/3.14/library/concurrency.html