开启进程的另一种方法
__init__方法解析
https://www.cnblogs.com/tp1226/p/8453854.html
class MyProcess(Process): # 定义一个类,继承Process这个类
def __init__(self,a,b,c): # __init__配置模块的初始化操作
self.a = a
self.b = b
self.c = c
super().__init__()
def run(self): # 重写run方法,实现多进程的程序代码
print(os.getppod(),os.getpid())
if __name__ =='__main__':
for i in range(10):# 多次开启子进程
p = MyProcess(a,b,c)
p.start()
print(p.pid)
print(p.name)
print(p.ident) # 它和pid是一回事
p.terminate() # 强制结束一个子进程
print(p.is_alive) # 查看进程是否还活着