标签:linu linux inux proc python ted lin pre star
import os print(‘Process (%s) start...‘ % os.getpid()) # Only works on Unix/Linux/Mac: pid = os.fork()
#os.fork()创建2个进程,返回值为0时,表示子进程,返回值为子进程号是---父进程os.getpid()表示当前进程 if pid == 0: print(‘I am child process (%s) and my parent is %s.‘ % (os.getpid(), os.getppid())) else: print(‘I (%s) just created a child process (%s).‘ % (os.getpid(), pid))
标签:linu linux inux proc python ted lin pre star
原文地址:https://www.cnblogs.com/heishanyaoren/p/12194677.html