python creation process in several ways and compare

method one   

K = os.fork ()

if right == 0:

 # Child process

else:

  # Parent process

# Rarely used in this way

 

 

 

Second way:

p1 = Process(target=xxxx)

p1.start()

# Master and child processes can be performed

 

Three ways:

pool = pool (3)

pool.apply_async(xxxxx)

# ,,,, wait for the main process is generally used to perform real tasks in the child, the way to create this non-clogging process pool

Published 267 original articles · won praise 36 · views 190 000 +

Guess you like

Origin blog.csdn.net/qq_40270754/article/details/96842554