[X-Unix] Kill

Cloyce D. Spradling cloyce+xunix at headgear.org
Wed Feb 25 07:27:07 PST 2004


On Wed, Feb 25, 2004 at 10:08:21AM -0500, Alex wrote:

: Terminal: Top reports 1 process stuck (presumable TextEdit). Not being 
: in the sudoers file, the user can't invoke kill.

Actually, user _can_ invoke kill.  You're allowed to kill any process you
own, with any signal you like.  This is actually all that "Force Quit" is
doing.

: Query: What else could I have done to get rid of the stuck process? 

Nothing, I think.

: Shouldn't kill -9 have nuked TextEdit, no ifs, ands, or buts?

This is a common misconception.  It's true that SIGKILL (which is what you're
asking for with -9) is uncatchable by the process, but all kill really does
is set a bit in the process structure.  When the process causes a transition
between kernel mode and user mode, these bits are checked and the appropriate
actions taken.  These transitions normally happen very often, like whenever
the process does a system call (read or write, for example) or when its
time slice starts or ends.

That seems to pretty much cover the bases, doesn't it?  So the only way to
have SIGKILL _not_ kill an active process is for the process to ask the
kernel to do something that it can't do or that takes a long time.  For
example, if you ask to read or write to a disk that the OS thinks is still
present and functional, but isn't, and if the driver can't detect this
condition, you get an unkillable process.

(Actually, you also can't kill zombies, but that's because they're not really
processes any more; they're just taking up space in the process table.)

--
Cloyce




More information about the X-Unix mailing list