Python Multiprocessing Jump-Start
Python Multiprocessing Jump-Start
Develop Parallel Programs, Side-Step the GIL, and Use All CPU Cores
Unlock parallel programming in Python (and run your code on all CPUs).
The multiprocessing module provides easy-to-use process-based concurrency in Python.
Unlike Python threading, multiprocessing side-steps the infamous Global Interpreter Lock (GIL), allowing full parallelism in Python.
This is not some random third-party library, this is an API provided in the Python standard library (already installed on your system).
This is the API you need to use to make your code run faster.
There's just one problem. Few developers know about it (or how to use it well).
Introducing: "Python Multiprocessing Jump-Start". A new book designed to teach you the multiprocessing module in Python, super fast!
You will get a fast-paced, 7-part course to get you started and make you awesome at using the multiprocessing API.
Each of the 7 lessons was carefully designed to teach one critical aspect of the multiprocessing module, with explanations, code snippets and worked examples.
Each lesson ends with an exercise for you to complete to confirm you understand the topic, a summary of what was learned, and links for further reading if you want to go deeper.
Table of Contents
-
Lesson 01: Process-Based Concurrency
- Python Concurrency
- What is Multiprocessing in Python
- Multiprocessing vs Threading
- When to Use Multiprocessing
-
Lesson 02: Create and Start Child Processes
- Main Process in Python
- Parent and Child Processes
- Life-Cycle of a Process
- Protect the Entry Point When Using Multiprocessing
- How to Run a Function in a Child Process
- How to Extend the Process Class
-
Lesson 03: Configuring and Interacting with Processes
- How to Configure New Processes
- How to Query the Status of a Process
- How to Terminate or Kill a Process
- How to Get the Current, Parent, and Child Processes
- How to Configure the Start Method
-
Lesson 04: Synchronize and Coordinate Processes
- How to Protect Critical Sections with a Mutex Lock
- How to Limit Access to a Resource with a Semaphore
- How to Signal Between Processes Using an Event
- How to Coordinate Using a Condition Variable
- How to Coordinate at a Point Using a Barrier
-
Lesson 05: Share Data Between Processes
- How to Inherit Global Variables from Parent Processes
- How to Share Python Primitives with ctypes
- How to Send Data to Processes with Pipes
- How to Use Producers and Consumers with Queues
-
Lesson 06: Run Tasks with Reusable Workers in Pools
- What Are Process Pools
- How to Use Multiprocessing Pools in Python
- How to Configure the Multiprocessing Pool
- How to Execute Tasks Synchronously and Asynchronously
- How to Use Callback Functions to Process Results
- How to Interact with Asynchronous Tasks
-
Lesson 07: Share Centralized Objects with Managers
- What Is a Manager
- How to Use A Manager
- What Objects Do Managers Support
- How to Use a Manager to Share a Data Structure
- How to Use a Manager to Share a Concurrency Primitive
Stop copy-pasting code from StackOverflow answers.
Learn Python concurrency correctly, step-by-step.
Learn more about this book here:
How to Buy
- Click the "I want this!" button (in the upper right)
- Choose Credit Card or PayPal and complete the order form then click the "Pay" button.
- You will be redirected to a webpage where you can download your bundle immediately (you will also get an email with the download link, just in case you need it).
About the Author
Jason Brownlee, Ph.D. helps Python developers bring modern concurrency methods to their projects with hands-on tutorials.
Jason loves Python Concurrency. It's all he does. It’s his main thing.
Jason has:
- Read all the books on Python concurrency.
- Used all of the Python concurrency APIs in the standard library.
- Written 500+ tutorials and 12+ books on Python concurrency.
Learn more at SuperFastPython.com
Jason is a software engineer and research scientist with a background in artificial intelligence and high-performance computing. He has authored more than 20 technical books on machine learning and has built, operated, and exited online businesses.
See his linkedin profile here:
- Jason Brownlee on LinkedIn (follow him!)
Any Questions?
Hi, Jason here, do you have any questions?
Contact me directly at any time about this product or Python concurrency generally. I'm here to help as best I can.
You can send an email directly to my inbox via:
You'll get a .zip download containing both ebook formats (pdf and epub) and all .py code files.