Subj : Re: pthreads (linux) questions To : comp.programming.threads From : Joe Seigh Date : Fri Aug 19 2005 09:29 am jacob navia wrote: > Joe Seigh wrote: > Or you could look into the > >> /proc//tasks/ >> directory to get the kernel thread ids. > > > Ahh, VERY interesting. Actually the first piece of > useful info I get. > > Maybe you would be so kind to tell > me if there is any documentation for /proc//tasks? > > (What should be in there, format of the info, etc) > > Thanks for that piece of info, and thanks in advance for any > documentation. If there was a document that would explain this stuff > it would spare me the time of asking and you the time of > answering... > No documentation that I know of except source. Most of the info is process related and will be identical the main process. What would be related to the main thread in the process will be thread related in the tasks directory, e.g. program and register state. I don't have a Linux system up and running right now so you'll have to poke around and figure out things for yourself. The pthread id to task id mapping is provided by the gettid system call. There's no task id to pthread id mapping except through implementation dependent register and memory, i.e. you'll have to figure out where thread local storage is and where the pthread id is. I think pthread id is just an offset into the thread local memory. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .