From: ebiederm@xmission.com (Eric W. Biederman)
To: Albert Cahalan <acahalan@gmail.com>
Cc: Kyle Moffett <mrmacman_g4@mac.com>, linux-kernel@vger.kernel.org
Subject: Re: anon unions are cool
Date: Mon, 23 Jan 2006 11:25:56 -0700 [thread overview]
Message-ID: <m1wtgqls23.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <787b0d920601221717v460283eclc72380ae541d7fef@mail.gmail.com> (Albert Cahalan's message of "Sun, 22 Jan 2006 20:17:21 -0500")
Albert Cahalan <acahalan@gmail.com> writes:
> This case is rather interesting. At more than one place I've worked,
> I found people assuming that the kernel's "pid" was a pid, when in
> fact it is a tid. (a "task ID" or "thread ID") The confusion probably
> leads to kernel bugs. I've seen many bugs related to this, though I
> can't be 100% sure that they don't all involve code that existed prior
> to the tgid concept.
Actually this is a really weird area. A lot of it depends on your
perspective. current->pid is more than just a thread group ID.
You can always use kill to send a signal to the ``pid'' of any
task. However if that task is part of a thread group the signal
might go to one of that threads siblings.
If you were to follow the normal rules and send to a signal
to a thread group. All threads would get it. Although I
don't think the kernel has code for that.
So from a signal perspective current->pid is the pid.
However get_pid has been modified to return the thread group id.
Instead of the PID. And a lot of times when you are exporting
information to user space you want the thread group id.
But in practice neither thread ID nor process ID map directly
to the kernels concept.
Then there is the other weird side where only the leaders of
thread groups are placed in sessions and process groups.
Eric
next prev parent reply other threads:[~2006-01-23 18:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-23 0:36 Albert Cahalan
2006-01-23 0:56 ` Kyle Moffett
2006-01-23 1:17 ` Albert Cahalan
2006-01-23 18:25 ` Eric W. Biederman [this message]
2006-01-24 3:39 ` Albert Cahalan
2006-01-24 6:04 ` Kyle Moffett
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=m1wtgqls23.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=acahalan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mrmacman_g4@mac.com \
/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®