Multiprocessing lets a program run multiple tasks at the same time by creating separate processes. Each process has its own memory and Python interpreter, which allows full use of multiple CPU cores. async_apply
and apply
are two methods provided by Python’s multiprocessing.Pool
for running parallel tasks.
Before we dive into the technical explanations of these methods, let’s talk shop. A mechanic’s shop. Imagine a mechanic’s shop with four repair bays. Just like CPUs, each bay has its own assigned mechanic team. A manager (the main