When a parent process is killed by “kill -9”, will subprocess also be killed?

前端 未结 5 1205
情书的邮戳
情书的邮戳 2021-02-01 05:38

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

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-01 06:20

    If u close the terminal pid which is the parent process id of the process then terminal is closed. And when terminal is closed then all its processes also gets killed. But if u create a sub shell in shell then if u create any process and kill ppid of that process then only that sub shell kill and their child becomes orphans. Their parent becomes init and pid is 1.

    [trainee@SIPL ~]$ ps -ef | grep sleep trainee 3893 3870 0 10:55 pts/1 00:00:00 sleep 4000 trainee 3895 3788 0 10:55 pts/0 00:00:00 grep --color=auto sleep [trainee@SIPL ~]$ kill -9 3870 [trainee@SIPL ~]$ ps -ef | grep sleep trainee 3893 1 0 10:55 pts/1 00:00:00 sleep 4000 trainee 3906 3788 0 10:55 pts/0 00:00:00 grep --color=auto sleep

提交回复
热议问题