how kernel distinguish threads

Feng Xian feng.xian at gmail.com
Tue Jul 10 19:58:57 UTC 2007


Thanks. gettid() works.

On 7/9/07, Chuck Ebbert < cebbert at redhat.com> wrote:
>
> On 07/09/2007 06:29 PM, Feng Xian wrote:
> > Hi, I am working on a project about reducing page faults of
> multi-threaded
> > programs. I am using latest Fedora core (Linux 2.6) and pthread library.
> In
> > this project, each user-level  thread (created by pthread_create()
> > function)
> > needs to pass a value to the task structure in the kernel which
> corresponds
> > to the thread. The first step is getting a unique id of the task
> structure
> > of each thread. But what is this unique id?
> >
> > I tried to use getpid() to get the process id of each thread and use it
> as
> > unique id. But this didnt work out since all threads in a process share
> the
> > same pid. I tried to use the thread_id returned by pthread_create()
> > function
> > but this id is meaningless to the kernel. Could anyone help me out on
> this?
>
> Use gettid() ??
>
>


-- 
Addr: 1025N, 23rd str, APT 33,
         Lincoln, NE, 68503
Phone: (402)310-9826
WWW: cse.unl.edu/~fxian <http://cse.unl.edu/%7Efxian>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-kernel-list/attachments/20070710/136e0428/attachment.htm>


More information about the Fedora-kernel-list mailing list