import multiprocessing as mu
import time
import os
def dance():
print('当前的dance进程号',os.getpid())
print('当前的父进程号',os.getppid())
# print(os.getpid())
print('当前的dance进程名字',mu.current_process())
for i in range(2):
time.sleep(0.4)
print("跳舞中。。。")
os.kill(os.getpid(),9)
def sing():
print('当前的sing进程号为',os.getpid())
print('当前的父进程号', os.getppid())
print('当前的sing进程名字',mu.current_process())
for i in range(2):
time.sleep(0.5)
print("唱歌中。。。")
if __name__=='__main__':
print('当前的主进程号', os.getpid())
# print(os.getpid())
print('当前的主进程名字', mu.current_process())
dancePro=mu.Process(target=dance)
singPro=mu.Process(target=sing)
singPro.start()
dancePro.start()