When you kill only a process, it will not kill children.
You must send a signal to a process group if you want all processes for this group to receive a signal.
kill -9 -parentpid
Otherwise, the orphans will be bound to init .
The child may ask the kernel to deliver SIGHUP (or another signal) when the parent dies by specifying the PR_SET_PDEATHSIG option in prctl() syscall, like this:
prctl(PR_SET_PDEATHSIG, SIGHUP);
See man 2 prctl more details.
source share