6
可能重複:
Multiprocessing launching too many instances of Python VM爲什麼python多處理模塊導致CPU完全耗盡?
我試圖用這個簡單的代碼片段的Python 2.6多處理模塊。
from multiprocessing import Pool
p = Pool(5)
def f(x):
return x*x
print p.map(f, [1,2,3])
但是,這段代碼導致我的操作系統停止響應。看起來CPU太忙了。 我的代碼有什麼問題?
順便說一句:看來多處理模塊有點危險。我不得不重新啓動我的電腦。
@Trent:那不好:) – jkp 2010-01-20 15:20:41
看到這個:http://stackoverflow.com/questions/1923706/multiprocessing-launching-too-many-instances-of-python-vm – 2010-01-20 16:48:24