【发布时间】:2017-02-14 23:53:38
【问题描述】:
我通过使用多处理提高了执行时间,但我不确定 PC 的行为是否正确,它会冻结系统直到所有进程完成。 我正在使用 Windows 7 和 Python 2.7。
也许我做错了,这就是我所做的:
def do_big_calculation(sub_list, b, c):
# do some calculations here with the sub_list
if __name__ == '__main__':
list = [[1,2,3,4], [5,6,7,8], [9,10,11,12]]
jobs = []
for sub_l in list :
j = multiprocessing.Process(target=do_big_calculation, args=(sub_l, b, c))
jobs.append(j)
for j in jobs:
j.start()
【问题讨论】:
标签: python windows python-multiprocessing