The life of a process
Within the multiprocessing module, we have three distinct methods of starting processes within our Python programs:
- Spawn
- Fork
- Forkserver
While you may never call upon this knowledge while you are crafting your multiprocess programs in Python, it's worthwhile to know how the underlying mechanisms work, and how they differ from one operating system to another.
Note
I'd recommend that you check out the official Python documentation which can be found here: https://docs.python.org/3.6/library/multiprocessing.html#contexts-and-start-methods.
Starting a process using fork
Forking is the mechanism used on Unix systems in order to create child processes from the parent process. These child processes are almost identical to their parent process and similar to the real world: children inherit all of the resources available to the parent.
The fork command is a standard system command found in the Unix ecosystem.
Spawning a process
By spawning a separate process, we spin up a second distinct...