一、进程、程序
1.编写完成的代码,在没有运行的时候,称之为程序
2.正在运行着代码,称之为进程
二、用fork创建进程

import os res = os.fork() if res == 0: while True: print(‘111111‘) time.sleep(1) else: while True: print(‘22222‘) time.sleep(1) #结果为: 111111 22222 111111 22222
1.os.getpid():获取当前进程id
2.os.getppid():获取父进程的id