Tech Support > Operating Systems > Linux / Variants > Quickie: Difference between killall and killall -9
Quickie: Difference between killall and killall -9
Posted by Wally Sanford on October 5th, 2003


I can not for the life of me find a difference in using `killall` and
`killall -9` to kill all instances of an app. Even the man page for killall
doesn't lend much help this time.

for example,
killall httpd
and
killall -9 httpd
kills all instances of httpd.

The reason I ask is most example and usenet postings typically use
`killall -9`, so what, if any, gain or overall diference is there?

Thanks


Posted by armin walland on October 5th, 2003


Wally Sanford <wsanford@wallysanford.com> wrote:
the difference is which signal is being sent to the process.

take a look at "info kill"

SIGTERM is the default signal, -9 sends SIGKILL.
-9 should only be used if -15 doesn't work.
usually you would use /etc/init.d/apache stop or however the init script
is called.



--

life, the universe and everything
http://www.dtch.org


Posted by Wally Sanford on October 5th, 2003


"armin walland" <geschrei@gmx.at> wrote in message
news:1065389614.595447@zombie...
Thank you. And what does -15 send if I may ask? Or is that the default?
(SIGTERM)

True. `/etc/init.d/httpd` for me (and `service httpd stop` works too.) I was
just using it as an example, though not a terribly good one I see.



Posted by TCS on October 5th, 2003


On Sun, 5 Oct 2003 14:26:03 -0700, Wally Sanford <wsanford@wallysanford.com> wrote:
killall by itself lets the process run it's exit handler, to close open
files for example. I believe kill{all} without a signel number is the
same as using signal 3 1.

Killall -9 sends signal #9 which cannot be caught. It is to stop a process in
it's tracks without a chance to run it's exit handler.


Posted by Jim on October 5th, 2003


Wally Sanford wrote:
to update logs, or anything else. It just goes away. kill -15,
whatever it sends, can be caught and can allow a program to
recover gracefully and shut itself down. The difference can
be appreciated more fully when one has a database that handles
its own cache in memory. kill -9 it and you'll have trouble
with transactions that should have been written to disk but
never were. Many other examples exist. I found many of them
by unfortunate experiment.

Jim


Posted by mjt on October 5th, 2003


Wally Sanford wrote:

.... the diff is the signal sent. kill, w/o a specified signal, then
SIGTERM is sent. an application is not obligated to respond to it;
"-9 will (SIGKILL) [can not be caught]"
..
--
/// Michael J. Tobler: motorcyclist, surfer, skydiver, \\\
\\\ and author: "Inside Linux", "C++ HowTo", "C++ Unleashed" ///
\\\ http://pages.sbcglobal.net/mtobler/mjt_linux_page.html ///
"The National Association of Theater Concessionaires reported that in
1986, 60% of all candy sold in movie theaters was sold to Roger Ebert."
- D. Letterman


Posted by John Hasler on October 5th, 2003


TCS writes:
Bad example. Try it. Writing out logs is a better example.
--
John Hasler
john@dhh.gt.org (John Hasler)
Dancing Horse Hill
Elmwood, WI

Posted by mjt on October 5th, 2003


TCS wrote:

..... 15
..
--
/// Michael J. Tobler: motorcyclist, surfer, skydiver, \\\
\\\ and author: "Inside Linux", "C++ HowTo", "C++ Unleashed" ///
\\\ http://pages.sbcglobal.net/mtobler/mjt_linux_page.html ///
Anyone who hates Dogs and Kids Can't be All Bad. - W. C. Fields


Posted by Ed Murphy on October 6th, 2003


On Sun, 05 Oct 2003 23:50:20 +0000, mjt wrote:

Out of curiosity, why do you sometimes translate spaces to
half-width-spaces in the text to which you're replying?


Posted by Chris F.A. Johnson on October 6th, 2003


On Mon, 06 Oct 2003 at 04:50 GMT, Ed Murphy wrote:
What's a half-width-space? Spaces are a character, ASCII 32. It
has no intrinsic width.

--
Chris F.A. Johnson http://cfaj.freeshell.org
================================================== =================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License

Posted by Andy Baxter on October 6th, 2003


Wally Sanford wrote:

Someone correct me if I'm wrong, but I think this difference is that with
most of the signals you send to a process, the signal goes to a part of
that program which is listening to see if a signal has been received. When
one is, then it carries out the appropriate action. So if you send signal
15, which is the one that gets sent if you just type 'kill <psid>', then
the program receives this signal and then runs the code which will shut
itself down smoothly. There are various other signals which you can send to
a program - see man kill.
But there are a few special signals, like SIGKILL/-9 which don't go to the
program in question but to the process management code in the kernel, so
the program has no warning and no chance to tidy things up cleanly before
it is killed. In the case of SIGKILL, the kernel will simply stop running
that process and remove it and any libaries it has loaded from memory
without warning. Another unblockable signal is SIGSTOP, which stops running
the program but leaves it in memory so it can be restarted with SIGCONT.
It's (a bit) like if you're talking to someone on the phone and you want to
end the conversation - you can either start making 'lets say goodbye now'
noises and wait for the conversation to end naturally, or you can just put
the phone down.

andy.

--
remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with [html] or [attachment] in the subject line.

Posted by Ed Murphy on October 6th, 2003


On Mon, 06 Oct 2003 04:56:41 +0000, Chris F.A. Johnson wrote:

'od' reveals that the characters in question are ASCII 160. Formally,
it's a "non-breaking space". (They happen to be rendered as narrow
spaces on my system.)



Similar Posts