GETPID Get Process ID
Gettid: Gets the thread ID, if it is a process, equals getpid
Getgid:user Group ID
It is complicated: pid is process identifier; tid is thread identifier.
But as it happens, the kernel doesn ' t make a real distinction between them:threads is just like processes but they share Some things (memory, FDS ...) with other instances of the same group.
So, a tid was actually the identifier of the Schedulable object in the kernel (thread), while the PID is The identifier of the group of Schedulable objects that share memory and FDS (process).
Things more interesting, when a process had only one thread (the initial situation and in the good old times T He only one) the PID and the tid is always the same. So any function, the works with atid would automatically work with a pid.
It is worth noting this many Functions/system Calls/command line utilities documented to work with pidactually us E tids. But if the effect are process-wide you'll simply not notice the difference.
Other than that:
Gettid is the ID of the thread in the kernel, pthread_self is the POSIX thread ID
Linux pid tid gid