# Author: Sooele from multiprocessing import Process import os def info(title): print(title) print('module name:', __name__) #打印模块的名称 print('parent process:', os.getppid()) #输出父进程 #getppid父进程的id print('process id:', os.getpid()) #进程的id print("\n\n") def f(name): info('\033[31;1mfunction f\033[0m') print('hello', name) if __name__ == '__main__': info('\033[32;1mmain process line\033[0m') #执行info的方法 p = Process(target=f, args=('bob',)) p.start() p.join() #Liunx上每一个 进程 都是由 父进程 启动
