Re: same pid ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/2/11 Steve Graegert (スティーブ) <graegerts@xxxxxxxxx>:
> POSIX.1 requires threads to share a couple of attributes (mainly
> process attributes) like the process ID, open FDs and many others.
> What you are referring to ("everything as task") is the fact that each
> thread is associated with a single scheduling entity within the kernel
> implementing a 1:1 mapping.  Yet, threads created within the same
> process share a single PID.
>

Thanks steve.

I found some more info. posix thread uses CLONE_THREAD with clone()
system call.
i quoted from - man clone

CLONE_THREAD (since Linux 2.4.0-test8)
    If CLONE_THREAD is set, the child is placed in the same thread
group as the calling process. To make the remainder of the discussion
of CLONE_THREAD more readable, the term "thread" is used to refer to
the processes within a thread group.

    Thread groups were a feature added in Linux 2.4 to support the
POSIX threads notion of a set of threads that share a single PID.
Internally, this shared PID is the so-called thread group identifier
(TGID) for the thread group. Since Linux 2.4, calls to getpid(2)
return the TGID of the caller.

-Ratheesh



> On Fri, Feb 11, 2011 at 03:18, ratheesh k <ratheesh.ksz@xxxxxxxxx> wrote:
>>>On Fri, Feb 11, 2011 at 4:56 AM, Jonathan Isom <jeisom@xxxxxxxxx> wrote:
>>> Newer distros use Native POSIX Thread Library (NPTL).  They return the same pid.
>>
>> if linux treats every thing as task (both thread and process ) and
>> CLONE_PID flag is obsolete, i expected unique pid.
>

> You are advised to consult pthreads(7) to make yourself familiar with the topic.
>
> Steve
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux