The importance of killing processes with the right signal
Here is an important corollary to KillOrderImportance: when your system
is overloaded, you should always kill processes with 'kill -9
'.
There are a fair number of sources that will tell you that you should
always kill processes with something besides kill -9
, unless they
won't die from lesser measures. In an overloaded situation this is
terribly wrong: either the processes don't have a signal handler for the
lesser signal, in which case the two are equivalent, or they do have a
signal handler, in which case using the lesser signal simply causes them
to wake up (if they were sleeping) and churn around more.
Even in general I tend to be somewhat dubious about the advice; usually,
when I am killing a process with anything except a small list of
signals, I want it gone. Using 'kill -9
' makes completely sure of
this, in one go, without any fuss and bother.
(If you really want to give a process a chance to clean up, you need to
know what sort of program it is. User level programs tend to only catch
SIGHUP
, if that, while demons probably don't catch SIGHUP
but may
catch SIGTERM
, since many Unixes send everything SIGTERM
as part of
shutting down.)
|
|