October 2018
Beginner to intermediate
466 pages
12h 2m
English
As threads do, multiprocessing also has problems, some of which we have already discussed. There is no best way to do concurrency; this is especially true in Python. We always need to examine the parallel problem to figure out which of the many available solutions is the best one for that problem. Sometimes, there is no best solution.
In the case of multiprocessing, the primary drawback is that sharing data between processes is costly. As we have discussed, all communication between processes, whether by queues, pipes, or a more implicit mechanism, requires pickling the objects. Excessive pickling quickly dominates processing time. Multiprocessing works best when relatively small objects are passed between ...