Recall
We've looked closely at a variety of topics related to concurrent processing in Python:
- Threads have an advantage of simplicity for many cases. This has to be balanced against the GIL interfering with compute-intensive multi-threading.
- Multiprocessing has an advantage of making full use of all cores of a processor. This has to be balanced against interprocess communication costs. If shared memory is used, there is the complication of encoding and accessing the shared objects.
- The
concurrent.futures
module defines an abstraction – the future – that can minimize the differences in application programming used for accessing threads or processes. This makes it easy to switch and see which approach is fastest. - The
async
/await
features of the Python language are supported by the AsyncIO package. Because these are coroutines, there isn't true parallel processing; control switches among the coroutines allow a single thread to interleave...