Python implements multi-process can use the System fork () method and Python's multiprocessing class
The 1,fork () method is provided by the Unix/linux operating system and comes with a fork () in the Python OS module.
Not available in Windows, this is its special place
- Before using the fork () method, let's take a look at the English explanation of the fork: The basic is fork, fork, branch meaning,
- So, when the fork () method creates a child process, it copies all the code in the main process to the child process
- Although all of the code for the parent process is replicated, the child process does not execute all the code, where it was created in the parent process, and where the child process begins execution.
Import ospid = Os.fork () print ('!!! ') PID = Os.fork () print (' ~ ~ ') pid = Os.fork () print (' * * * ')
The code above creates 3 sub-processes, each of which creates its own child process, such as
Python multi-process programming fork ()