Jams.Liu
Jams.Liu

Reputation: 513

How to kill a TASK_KILLABLE process?

If a process sleep in TASK_KILLABLE state, we can kill it by signal 'SIGKILL' to it.

"kill -9 pid" will set sig in 'task_struct->signal->shared_pending', then wake up the process.

But, wait_event_killable only check "task_struct->pending" to see if a fatal signal are pending.(__fatal_signal_pending)

So, kill -9 can not kill a KILLABLE process.

How to kill a TASK_KILLABLE process?

Upvotes: 0

Views: 704

Answers (1)

tyChen
tyChen

Reputation: 1494

Firstly, like most versions of Unix, Linux has two fundamental ways in which a process can be put to sleep.

A process which is placed in the TASK_INTERRUPTIBLE state will sleep until either (1) something explicitly wakes it up, or (2) a non-masked signal is received.

The TASK_UNINTERRUPTIBLE state, instead, ignores signals; processes in that state will require an explicit wakeup before they can run again.

TASK_KILLABLE is a state of task_struct which comes from TASK_UNINTERRUPTIBLE, but this can be wake up by signals.

So, I think this process is killable if it sets as TASK_KILLABLE. Here is some source that can help you get deep understand.

Upvotes: 1

Related Questions