from multiprocessing import Pool def job(num): return num * 2 if __name__ == '__main__': p = Pool(processes=100) data = p.map(job, [i for i in range(100)]) p.close() print(data) import time import multiprocessing def basic_func(x): if x == 0: return 'zero' elif x%2 == 0: return 'even' else: return 'odd' def multiprocessing_func(x): y = x*x time.sleep(2) print('{} squared results in a/an {} number'.format(x, basic_func(y))) if __name__ == '__main__': starttime = time.time() processes = [] for i in range(0,10): p = multiprocessing.Process(target=multiprocessing_func, args=(i,)) processes.append(p) p.start() for process in processes: process.join() print('That took {} seconds'.format(time.time() - starttime))