Difference between PID and TID

后端 未结 4 672
刺人心
刺人心 2020-11-30 22:42

What is the difference between PID and TID?

The standard answer would be that PID is for processes while TID is for threads. However, I have seen that some commands

4条回答
  •  感情败类
    2020-11-30 23:23

    Actually, each thread in a Linux process is Light Weight Process (LWP). So, people may call thread as a process... But there is surely a difference. Each thread in a process has a different thread ID (TID) and share the same process ID (PID).

    If you are working with pthread library functions, then these functions don't use these TIDs because these are kernel/OS level thread IDs.

提交回复
热议问题