The standard multiprocessing module can be used to quickly parallelize simple tasks by spawning several processes, while avoiding the GIL problem. Its interface is easy to use and includes several utilities to handle task submission and synchronization.
Using multiple processes
The Process and Pool classes
You can create a process that runs independently by subclassing multiprocessing.Process. You can extend the __init__ method to initialize resources, and you can write the portion of the code that will be executed in a subprocess by implementing the Process.run method. In the following code, we define a Process class that will wait for one second and print its assigned id:
import multiprocessing
import time
class Process(multiprocessing.Process):
...