Linux - Linux中线程为何有PID?

重现

用htop的Tree view(按F5)之后查看线程

参考

https://segmentfault.com/q/1010000003586656 mousycoder的回答
https://unix.stackexchange.com/a/166403 stantona的回答
http://man7.org/linux/man-pages/man2/gettid.2.html

总结

其实htop中线程的PID是TID(Thread ID)。可以打开TGID(Thread group ID等于当前进程的PID)这个选项,一个进程中的所有线程TGID都是一样的。

posted @ 2019-07-25 12:24  Rocin  阅读(766)  评论(0编辑  收藏  举报