multiprocessing - Is there no need to reap zombie process in python? -


it seems me in python, there no need reap zombie processes.

for example, in following code

    import multiprocessing     import time      def func(msg):         time.sleep(2)         print "done " + str(msg)      if __name__ == "__main__":         in range(10):             p = multiprocessing.process(target=func, args=('3'))             p.start()             print "child"+str(i)         print "parent"         time.sleep(100) 

when child process exit, parent process still running , @ time, checked process using ps -ef , noticed there no defunct process.

does mean in python, there no need reap zombie process?

after having library - multiprocessing/process.py -, see that

  1. in process.start(), there _current_process._children.add(self) adds started process list/set/whatever,
  2. a few lines above, there _cleanup() polls , discards terminated processes, removing zombies.

but doesn't explain why code doesn't produce zombies, childs wait while befor terminating, parent's start() calls don't notice yet.


Comments