最佳答案
What's the difference between using map
and map_async
? Are they not running the same function after distributing the items from the list to 4 processes?
So is it wrong to presume both are running asynchronous and parallel?
def f(x):
return 2*x
p=Pool(4)
l=[1,2,3,4]
out1=p.map(f,l)
#vs
out2=p.map_async(f,l)