# import time,multiprocessing#导入进程模块
# import threading
# def run(name):
# time.sleep(2)
# print("hello%s"%name)
# t=threading.Thread(target=thread_run)#
# t.start()
# def thread_run():
# print(threading.get_ident())#获取当前线程id
# if __name__=="__main__":
# for i in range(50):
# p=multiprocessing.Process(target=run,args=("%s"%i,))
# p.start()
from multiprocessing import Process
import os
def run():
print(os.getppid())#查看父进程的id
print(os.getpid())#查看子进程的id
def f():
run()
if __name__=="__main__":
run()
p=Process(target=f)
p.start()
#从以上可以看出,子进程是由父进程生成的