multiprocessing — Manage Processes Like Threads

Purpose:Provides an API for managing processes.

The multiprocessing module includes an API for dividing work up between multiple processes based on the API for threading. In some cases multiprocessing is a drop-in replacement, and can be used instead of threading to take advantage of multiple CPU cores to avoid computational bottlenecks associated with Python’s global interpreter lock.

Due to the similarity, the first few examples here are modified from the threading examples. Features provided by multiprocessing but not available in threading are covered later.

See also