Hi... > > Hi, I did a quick look at the code of the NPTL. I found that the > > pthread_self does not return the tid but the address of the struct > > pthread which is allocated in the stack (at least on i386 and > > possibly on other Arch too). Struct pthread contains various > > information used by the pthreaded calls. It created in the stack > > during pthread creation. pthread_self just finds the structure from > > stack and return its address. Great, thanks for sharing the info :) > clone(child_stack=0xb7f7d4d4, > flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND| > CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS| > CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, > parent_tidptr=0xb7f7dbe8, > {entry_number:6, base_addr:0xb7f7dba0, limit:1048575, > seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, > seg_not_present:0, useable:1}, > child_tidptr=0xb7f7dbe8) = 21945 hm, IIRC, what you see there (base_addr) is base address of TLS segment. This segment is mapped on certain entry (see entry_number) in local CPU GDT. Also, this segment is separated for user mode stack. However, it makes sense to use base_addr of TLS segment since I must unique for each thread on the same thread group. regards Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/