Sunday, 25 August 2013

How to list killable tasks?

How to list killable tasks?

As manpage of ps states A process with STATUS with the value "D" means
"uninterruptible sleep (usually IO)"
Also, I've read: You should use TASK_INTERRUPTIBLE here, otherwise your
kernel thread cannot receive signals and you are not able to kill(1) your
thread from userspace or use kthread_stop() in the kernel.
If the above is not enough you can read: process status (STAT) of D
indicates that the process is in an "uninterruptible sleep" state. In
real-world terms, this generally means that it's waiting on I/O and
can't/won't do anything - including dying - until that I/O operation
completes.
Let's say I run a process that waits IO:
[root@mpinode02 Distros]# find / -mmin +10 > /dev/null &
[1] 15592
Then I take a look to the status and wchan process
[root@mpinode02 Distros]# ps -C find -ostat,comm,wchan
STAT COMMAND WCHAN
D find sleep_on_buffer
OK, let's see if the process is really uninterrumpible:
[root@mpinode02 Distros]# kill 15592
[1]+ Terminated time find / -mmin +10 > /dev/null
So, as you can see process with D in the real world was killed, is the man
page of ps outdated?
Indeed I see that there is a new kind of state: TASK KILLABLE but I want
to know hot to list them. Do you know how to list killable tasks or
identify them?

No comments:

Post a Comment