lkml.org 
[lkml]   [2009]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectProcess id recycling and status of tasks
From
Hello,

1. What would be an ideal way to check if a task is alive or dead from
kernel space?
I dont want to check current execution state of the task, rather I
want to check whether task
with this pid is existing currently or not? I might want to do it
periodically, hence even though
a certain pid might exist, it might have got recycled by the time I
check again, right?

Following is an elementary attempt to achieve the same, but I am not
convinced much, and
I am not even sure I can do this kind of thing without knowing the
context I am executing in.

task_t *p;
read_lock(&tasklist_lock);
for_each_process(p) {
if ( strcmp (p->comm, $your-daemon-name) == 0)
break;
}
read_unlock(&tasklist_lock);


2. Basically, what would be parameters of a task which will uniquely
identify a task which ever
existed on my machine. Would it be <name, pid> tuple? Or something
else which uniquely
does this job? Basically differentiate N user space threads in a process.

3. What is the algorithm followed for recycling pids? It does not look
very straight fwd like
pick up the latest freed pid for new task etc. I guess the pid
recycling must be starting after
certain threshold.

Any pointers will be helpful.

-Leo.


\
 
 \ /
  Last update: 2009-10-22 15:39    [W:0.059 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site