Pid:
GETPID Get Process ID
Tid
Gettid: Gets the thread ID, if it is a process, equals getpid
Gid:
Getgid:user Group ID
Reference StackOverflow
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.
Original: Http://stackoverflow.com/questions/4517301/difference-between-pid-and-tid
Other than that:
Gettid is the ID of the thread in the kernel, pthread_self is the POSIX thread ID
Linux pid tid gid