Re: A question about _thread_ of Linux

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

 



To summarize:
tgid <==> getpid() <==> pid of the process which invokes (call
pthread_create) the threads and is common to all threads invoked by
the process.
tid <==> pthread_self() <==> pid of the particular thread, and is
unique to each process....

my results is:
main pid: 2470
In the thread 0:tid 3086744480
In the thread 0:pid 2470
In the thread 1:tid 3076254624
In the thread 1:pid 2470

Yes, getpid() does return the tgid. but I don't think pthread_self() will
return the pid of the lighweight process. Because "Understanding the
Linux Kernel" said that the thread group leader's pid equals to the tid,
we can't find such a thread(lightweight process) in above results.

Regards,
Cheng

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux