Chapter 13. Multiprocessing – When a Single CPU Core Is Not Enough

In the previous chapter, we discussed factors that influence performance and some methods to increase performance. This chapter can actually be seen as an extension to the list of performance tips. In this chapter, we will discuss the multiprocessing module, a module that makes it very easy to make your code run on multiple CPU cores and even on multiple machines. This is an easy way to work around the Global Interpreter Lock (GIL) that was discussed in the previous chapter.

To summarize, this chapter will cover:

  • Local multiprocessing
  • Remote multiprocessing
  • Data sharing and synchronization between processes

Multithreading versus multiprocessing

Within this book we haven't really covered ...

Get Mastering Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.