Why Can't I Kill My Process?


Contents

About this document
To kill a process
Delivery of signals to a system call

About this document

This document applies to all levels of AIX.


To kill a process

Sometimes it is necessary to eliminate a process entirely. This is the purpose of the kill command. The syntax of the kill command, which is actually a general purpose process signalling utility, is as follows:

    kill [-signal] PID 

The kill command (or kill -15 which is the default signal) sends a SIGTERM signal to a process. This signal can be trapped, thus ignored by a process.

The kill -9 command sends a SIGKILL command to the process. If the process is currently in USER mode, this signal cannot be caught or trapped and the process will terminate.

Occasionally, processes will not die even after being sent the kill signal. The majority of such processes fall into one of the following categories:

There are two modes a process can be in, USER mode and KERNEL mode.

The process goes into kernel mode anytime it needs to access system functions via a system call routine. While in the kernel mode, signals are ignored until the system call exits back to user mode. At that time, any pending signals are handed to the user process.

If while in kernel mode, the process goes to sleep while waiting on a resource and the resource never becomes available, the process will never exit kernel mode.

The only way to kill a process that is "ignoring" or "sleeping" in kernel mode is to restart the system.

NOTE: Signals are defined in the /usr/include/signal.h file and the command kill -l may be used to generate a list of their symbolic names.


Delivery of signals to a system call

The kernel delays the delivery of all signals, including SIGKILL, when starting a system call, device driver, or other kernel extension. The signal takes effect upon leaving the kernel and returning from the system call. This happens when the process returns to the user protection domain, just before running the first instruction at the caller return address.


[ Doc Ref: 90605225314686     Publish Date: Jan. 29, 2001     4FAX Ref: 6961 ]