标签:数据 get 流水线 执行 空间 pre 创建 查看 解释
from multiprocessing import Process
from threading import Thread
import time
def test():
pass
if __name__ == '__main__':
p = Process(target=test)
t = Thread(target=test)
start1 = time.time()
p.start()
p.join()
end1 = time.time()
start2 = time.time()
t.start()
t.join()
end2 = time.time()
print(end1 - start1)
print(end2 - start2)
from multiprocessing import Process
from threading import Thread
import time
x = 1
def test():
global x
x= 100
print("我完成了")
if __name__ == '__main__':
# 查看进程是否可修改数据
p = Process(target=test)
p.start()
time.sleep(2)
print(x)
# 查看线程是否可修改数据
# t = Thread(target=test)
# t.start()
#
# time.sleep(1)
# print(x)
XMind: ZEN - Trial Version
标签:数据 get 流水线 执行 空间 pre 创建 查看 解释
原文地址:https://www.cnblogs.com/marklijian/p/11575112.html