📜  python代码示例中的fork函数

📅  最后修改于: 2022-03-11 14:46:24.586000             🧑  作者: Mango

代码示例1
# Python code to create child process 
import os
  
def parent_child():
    n = os.fork()
  
    # n greater than 0  means parent process
    if n > 0:
        print("Parent process and id is : ", os.getpid())
  
    # n equals to 0 means child process
    else:
        print("Child process and id is : ", os.getpid())
          
# Driver code
parent_child()