This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] manual: Document thread/task IDs for Linux


* Carlos O'Donell:

>> +Completion}.  (The parent process can arrange for such waiting to
>> +happen implicitly.)  A process ID uniquely identifies a process only
>> +during the lifetime of the process.  As a rule of thumb, this means
>> +that the process must still be running.
>> +
>> +Process IDs can also denote process groups and sessions.
>> +@xref{Job Control}.
>> +
>> +@cindex thread ID
>> +@cindex task ID
>> +@cindex thread group
>> +On Linux, threads created by @code{pthread_create} also receive a
>> +number form the process ID namespace, a @dfn{thread ID}.  The thread
>
> s/form/from/g

Fixed, thanks.

> We haven't defined what a "process ID namespace" is in this context,
> would it be simpler to write:
>
> "On Linux, threads created by @code{pthread_create} also receive a
> unique identifier in the form of a number, a @dfn{thread ID}."
>
> or
>
> "On Linux, threads created by @code{pthread_create} also receive a
> unique identifier in the form of a number, a @dfn{thread ID}, which
> is taken from the set of currently available process IDs."

I see why this is confusing if you come from a Linux namespace
background.  I didn't want to actually refer to Linux namespaces here.
What I wanted to express is that the thread ID is taken from the same
set that process IDs are drawn from, subject to similar constraints.
So I wanted to use “namespace” as a shorthand for “the set of available
names” (although names are really numbers here).

(I think we should not call these IDs unique because they are not unique
over time, only at every instant.)

What about this?

On Linux, threads created by @code{pthread_create} also receive a a
@dfn{thread ID}.  The thread ID of the initial (main) thread is the
same as the process ID of the entire process.  Thread IDs for
subsequently created threads are distinct.  They are allocated from
the same numbering space as process IDs.  Process IDs and thread IDs
are sometimes also referred to collectively as @dfn{task IDs}.  In
contrast to processes, threads are never waited for explicitly, so a
thread ID becomes eligible for reuse as soon as a thread exits or is
canceled.  This is true even for joinable threads, not just detached
threads.  Threads are also assigned to a @dfn{thread group}.  In
@theglibc{} implementation running on Linux, the process ID is the
thread group ID of all threads in the process.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]