# 了解:is_alive
from multiprocessing import Process
import time, os
def task():
print('%s is running,parent id is <%s>' % (os.getpid(), os.getppid()))
time.sleep(3)
print('%s is done,parent id is <%s>' % (os.getpid(), os.getppid()))
if __name__ == '__main__':
p = Process(target=task, name='sub——Precsss')
p.start()
p.terminate() # 结束需要时间,所以time.sleep(3)
time.sleep(3)
print(p.is_alive())
print('主')
print(p.name)