fork(2) download
  1. from multiprocessing import Pool
  2. import time
  3.  
  4. def worker(arg):
  5. print("worker for {} started".format(arg))
  6. time.sleep(arg)
  7. print("worker for {} stopped".format(arg))
  8.  
  9. pool = Pool(4)
  10. results = pool.map(worker, list(range(100)))
  11. pool.close()
  12. pool.join()
Time limit exceeded #stdin #stdout 5s 42016KB
stdin
Standard input is empty
stdout
Standard output is empty