Pyex2 Multiprocessing

Question

Compute the factorial of number. Demonstrate the use of multiprocessing.

Solution

from multiprocessing import Pool

def factorial(N, dictionary):
    "Compute a Factorial"

p = Pool(5)
result = p.map(factorial, range(1,1000,10))
for v in result:
    print v
Run this
Comments by Disqus