Linux pid tid gid

Source: Internet
Author: User

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

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.