本文介绍了当父进程被"kill -9"杀死时,子进程也会被杀死吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
今天早上,我的一位同事告诉我,他用"kill -9"杀死了 supervisord 时,主管并没有被杀死.
One of my colleague told me this morning, when he killed supervisord by "kill -9", the subprocesses of supervisord is not killed.
他对此很确定,但是我尝试了很多次却没有发现这种情况.
He is quite sure about that, but I tried many times and did not find that happen.
因此,当父进程被"kill -9"杀死时,Linux会确保它的子进程也被杀死吗?
So when a parent process is killed by "kill -9", will linux ensure that it's sub-processes also been killed?
推荐答案
您必须使子进程成为守护进程,以便在父亲被杀死(或去世)时被杀死,否则它们将被init(1)所采用.
You have to make the sub processes daemonic in order to have them killed when the father is killed (or dies), otherwise they are adopted by init(1).
这篇关于当父进程被"kill -9"杀死时,子进程也会被杀死吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!