Why doesn't kill work?

Deron Meranda deron.meranda at gmail.com
Fri Jan 28 03:14:59 UTC 2005


On Thu, 27 Jan 2005 21:04:16 -0500, David Liguori <liguorid at albany.edu> wrote:
> In another thread a user having problems with yum killed it.  I am
> curious how he accomplished that.  When I run yum (or any other command,
> for that matter), it stalls, and I stop it with ctrl-z, the following
> happens:
> ...
> As you see, the kill command produces no output here, but if I make up a
> pid at random it complains no such pid exists.


This is not a bug, this how it is supposed to work.

When you use control-Z from the shell to push a process to the
background, the process is also stopped (until you later use the
shell's fg or bg command).  When a process is in a stopped state
any signals are queued up for it (with a few exceptions such as the
SIGKILL (-9) signal).

This could be seen by running:
    cat /proc/6214/status
near the end you'll see a line like:
   ShdPnd: 0000000000004000

Since the default signal that kill(1) sends is a SIGTERM, and
SIGTERM is 15 (in file /usr/include/bits/signum.h) and the
15th bit starting from 1 is 0x4000, you'll see that the signal
is still "pending".

Only when the process is re-awoken will the signal actually
be delivered.  And it will only have it's effect when delivered.

-- 
Deron Meranda




More information about the users mailing list