Linux delete zombie process

1 linux kill command

List all available signals: kill -l
Common signals:
HUP 1: Reload process.
INT 2: Interrupt (same as Ctrl + C)
QUIT 3: Exit (same as Ctrl + )
KILL 9: Forced termination
TERM 15: Termination

2 kill cannot close the process

The kill command actually sends a signal to the process, -9 means unconditional exit, but the process decides whether to exit, that is, kill -9 cannot terminate the system process and daemon process.

2.1 Reasons for not being able to kill

(1) The process has become a zombie process (Zombie).
When its parent process recycles it or kills its parent process, the ps output cannot be seen.
(2) The process is in the kernel state.
When the Linux process is running, it is divided into two states: the kernel and the user. When the process enters the kernel state, all signals, including SIGKIL, will be blocked, so kill -9 is invalid.

2.2 Solutions

(1) Check the process: ps aux|grep python3(I mainly run the python3 program here)
insert image description here
(2) cd /proc/46127
cat status
insert image description here
(3) kill -9 父进程号(PPid) 子进程号(Tgid)
As shown above, execute: kill -9 46126 46127OK
insert image description here

Guess you like

Origin blog.csdn.net/weixin_50008473/article/details/127313003