如何找出僵死进程的父进程

今天在查看进程的时候,看到无数个cat,就像这样
Screen Shot 2015-03-24 at 23.14.53

然后我killall杀掉进程后变成这样:

Screen Shot 2015-03-24 at 23.16.09

但这个时候死活杀不掉了。。这是为毛??接下来我只能通过查看进程状态才行了,如下:

> cat /proc/32741/status                                                                                                      
Name:	cat
State:	Z (zombie)
Tgid:	32741
Ngid:	0
Pid:	32741
PPid:	32710
TracerPid:	0
Uid:	1000	1000	1000	1000
Gid:	100	100	100	100
FDSize:	0
Groups:	2 7 50 91 92 93 95 96 100
Threads:	1
SigQ:	27/63909
SigPnd:	0000000000000000
ShdPnd:	0000000000004000
SigBlk:	0000000000000000
SigIgn:	0000000000000000
SigCgt:	0000000180000000
CapInh:	0000000000000000
CapPrm:	0000000000000000
CapEff:	0000000000000000
CapBnd:	0000003fffffffff
Seccomp:	0
Cpus_allowed:	ff
Cpus_allowed_list:	0-7
Mems_allowed:	00000000,00000001
Mems_allowed_list:	0
voluntary_ctxt_switches:	2
nonvoluntary_ctxt_switches:	1

查出PPid,就是parent pid(父进程id),有了这个PPid,再查出导致此问题的进程,把它kill掉即可!

> cat /proc/32710/status                                                                                                     
Name:	chrome
State:	S (sleeping)
Tgid:	32710
Ngid:	0
Pid:	32710
PPid:	1
TracerPid:	0
Uid:	1000	1000	1000	1000
Gid:	100	100	100	100
FDSize:	256
Groups:	2 7 50 91 92 93 95 96 100
VmPeak:	  341320 kB
VmSize:	  341080 kB
VmLck:	       0 kB
VmPin:	       0 kB
VmHWM:	   47000 kB
VmRSS:	   47000 kB
VmData:	    1660 kB
VmStk:	     136 kB
VmExe:	   90652 kB
VmLib:	   60344 kB
VmPTE:	     464 kB
VmSwap:	       0 kB
Threads:	1
SigQ:	27/63909
SigPnd:	0000000000000000
ShdPnd:	0000000000000000
SigBlk:	0000000000000000
SigIgn:	0000000000000000
SigCgt:	0000000180000000
CapInh:	0000000000000000
CapPrm:	0000000000000000
CapEff:	0000000000000000
CapBnd:	0000003fffffffff
Seccomp:	0
Cpus_allowed:	ff
Cpus_allowed_list:	0-7
Mems_allowed:	00000000,00000001
Mems_allowed_list:	0
voluntary_ctxt_switches:	261533773
nonvoluntary_ctxt_switches:	45982
> killall chrome

查出来的结果!居然是chrome!!

Leave a Comment

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: