From: "Leonidas ." <leonidas137@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Process id recycling and status of tasks
Date: Thu, 22 Oct 2009 06:29:39 -0700 [thread overview]
Message-ID: <f22d86810910220629o433ee5d0u9857d1fb1f01cd6@mail.gmail.com> (raw)
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.
next reply other threads:[~2009-10-22 13:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-22 13:29 Leonidas . [this message]
2009-10-23 8:13 ` Clemens Ladisch
2009-10-24 18:07 ` Leonidas .
2009-10-25 10:49 ` Leonidas .
2009-10-26 8:41 ` Clemens Ladisch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f22d86810910220629o433ee5d0u9857d1fb1f01cd6@mail.gmail.com \
--to=leonidas137@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®