Thanks. gettid() works. <br><br><div><span class="gmail_quote">On 7/9/07, <b class="gmail_sendername">Chuck Ebbert</b> <<a href="mailto:cebbert@redhat.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
cebbert@redhat.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 07/09/2007 06:29 PM, Feng Xian wrote:<br>> Hi, I am working on a project about reducing page faults of multi-threaded
<br>> programs. I am using latest Fedora core (Linux 2.6) and pthread library. In<br>> this project, each user-level thread (created by pthread_create()<br>> function)<br>> needs to pass a value to the task structure in the kernel which corresponds
<br>> to the thread. The first step is getting a unique id of the task structure<br>> of each thread. But what is this unique id?<br>><br>> I tried to use getpid() to get the process id of each thread and use it as
<br>> unique id. But this didnt work out since all threads in a process share the<br>> same pid. I tried to use the thread_id returned by pthread_create()<br>> function<br>> but this id is meaningless to the kernel. Could anyone help me out on this?
<br><br>Use gettid() ??<br><br></blockquote></div><br><br clear="all"><br>-- <br>Addr: 1025N, 23rd str, APT 33,<br> Lincoln, NE, 68503<br>Phone: (402)310-9826<br>WWW: <a href="http://cse.unl.edu/%7Efxian" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
cse.unl.edu/~fxian
</a>