I came across a concept in Advanced Linux Programming. Here\'s a link: refer to 4.5 GNU/Linux Thread Implementation.
I\'m clear wit
All threads created by a process belong to this one process by defintion. To get this one process' process-id use getpid(), no matter from which of the process' threads.
The author of the document linked is correct, that under Linux (p)threads are implemented as distinct processes sharing the same address space as the one process they belong to. The latter however is not reflected by getpid(), the author of the linked document is wrong with this assumption.
To get the process-id of the distinct process created for a single thread use (the Linux specific) gettid()*1.
*1: Please note that the glibc does not provide a wrapper to this function call. Use syscall() to invoke it.