kill -9 发送SIGKILL信号给进程,将其终止,但对于以下两种情况不适用
1.该进程是僵尸进程(STAT z),此时进程已经释放所有的资源,但是没有被父进程释放。僵尸进程要等到父进程结束,或者重启系统才可以被释放。
2.进程处于“核心态”,并且在等待不可获得的资源,处于“核心态 ”的资源默认忽略所有信号。只能重启系统。
kill 只能杀死处于用户状态的进程。
怎么杀父进程呢.
ps -aux | grep "进程名称"
结果:
Name: uwsgi
Umask: 0000
State: S (sleeping)
Tgid: 10203
Ngid: 0
Pid: 10203
PPid: 24623
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 64
Groups: 0
VmPeak: 435896 kB
VmSize: 370360 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 34968 kB
VmRSS: 34968 kB
RssAnon: 33544 kB
RssFile: 1396 kB
RssShmem: 28 kB
VmData: 106248 kB
VmStk: 132 kB
VmExe: 1032 kB
VmLib: 15704 kB
VmPTE: 372 kB
VmSwap: 0 kB
Threads: 2
SigQ: 0/15075
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000001000000
SigCgt: 0000000188085e83
CapInh: 0000000000000000
CapPrm: 0000001fffffffff
CapEff: 0000001fffffffff
CapBnd: 0000001fffffffff
CapAmb: 0000000000000000
Seccomp: 0
Speculation_Store_Bypass: vulnerable
Cpus_allowed: 3
Cpus_allowed_list: 0-1
Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list: 0
voluntary_ctxt_switches: 14
nonvoluntary_ctxt_switches: 0
然后在使用 kill 杀掉父进程的ppid
kill -9 ppid
还是不得不说kill -9 过于暴力, 一般情况下 可以考虑使用
kill-15