|
在<<ULK2>>95页中关于LINUX对线程的支持的时候有以下描述.
All descriptors of the lightweight processes in the same thread
group are collected in a doubly linked list implemented through the thread_group field of
the task_struct structure. The identifier shared by the threads is the PID of the first
lightweight process in the group; it is stored in the tgid field of the process descriptors. The
getpid( ) system call returns current->tgid instead of current->pid, so all the
threads of a multithreaded application share the same identifier. The tgid field has the
same value as the pid field, both for normal processes and for lightweight processes not
included in a thread group. Therefore, the getpid( ) system call works as usual for them.
前面的很好理解,说有一个给同一线程组的tgid给所有给同组的轻量级进程共享.getpid()返回tgid代替pid.后面粗体的总值部分就不太明白了.
而且我看2.4的源代码,getpid()返回的还是PID的内容啊,不知是不是我理解错了,还请指教 |
|