4.22作业
进程创建的两种方式
# from multiprocessing import Process
# import time
#
# def task(name):
# print('%s is runnning'%name)
# time.sleep(3)
# print('%s is over'%name)
#
# if __name__ == '__main__':
# p=Process(target=task,args=('cyp',))
# p.start()
# print('主')
from multiprocessing import Process
import time
class Myprocess(Process):
def run(self):
print(111)
time.sleep(1)
print(222)
if __name__ == '__main__':
p=Myprocess()
p.start()
print('主')