Think about this: as the Linux kernel uses a unique task structure (struct task_struct) to represent every thread, and as the unique member within it has a PID, this implies that, within the Linux kernel, every thread has a unique PID. This gives rise to an issue: how can multiple threads of the same process share a common PID? This violates the POSIX.1b standard (pthreads; indeed, for a while Linux was non-compliant with the standard, creating porting issues, among other things).
To fix this annoying user space standards issue, Ingo Molnar (of Red Hat) proposed and mainlined a patch way back, in the 2.5 kernel series. A new member called the Thread Group IDentifier or TGID was slipped into the task structure. This is how it works: if the process is single-threaded, the tgid and pid values are equal. If it's a multithreaded process, then the tgid value of the main thread is equal to its pid value...