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
- in
process.start()
, there_current_process._children.add(self)
adds started process list/set/whatever, - 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
Post a Comment