Concurrent Execution¶
The modules described in this chapter provide support for concurrentexecution of code. The appropriate choice of tool will depend on thetask to be executed (CPU bound vs IO bound) and preferred style ofdevelopment (event driven cooperative multitasking vs preemptivemultitasking). Here’s an overview:
threading— Thread-based parallelismmultiprocessing— Process-based parallelismmultiprocessing.shared_memory— Provides shared memory for direct access across processes- The
concurrentpackage concurrent.futures— Launching parallel taskssubprocess— Subprocess managementsched— Event schedulerqueue— A synchronized queue classcontextvars— Context Variables
The following are support modules for some of the above services: