I have a python program which is called many times. In some cases I want to kill some of those instances, and any child subprocesses they might have spawned. So what I do right now is: import os # Ensure we get a brand new group process id os.setsid() group_process_id = os.getpgid(0) child_process = subprocess.run( cmd, process_group=current_pgid, ) ... then when I want to kill that python program, I get it input its group process id, and just call os.killpg(process_group_id, signal.SIGKILL) Is this approach sound, or would it leave zombie processes in my OS? Continue reading...