fork download
  1. # your code goes here
  2. from multiprocessing import Process
  3. import os
  4.  
  5. def run_proc(name):
  6. print('run child process %s (%s)..' % (name, os.getpid()))
  7.  
  8. if __name__=='__main__':
  9. print('parent process %s.' % os.getpid())
  10. p=Process(target=run_proc, args=('test',))
  11. print('child process will start')
  12. p.start()
  13. p.join()
  14. print('child process end')
Success #stdin #stdout 0.04s 11064KB
stdin
Standard input is empty
stdout
parent process 3584833.
child process will start
run child process test (3584836)..
child process end