[POSIX] implementation of pthread_create()

Mark Kirkwood markir at paradise.net.nz
Sun Mar 1 20:33:19 UTC 2009


overflow_ wrote:
> Hello to everybody.
>
> I would like to know
>
> 1) How is implemented the method pthread_create() in Linux? I mean, does it
> use a call to the clone() function or to fork()?
>
> 2) where is the implementation of pthread_create()? I know it's declared in
> thread.h, but where its implementation is located?
>
> Thank you very much
>   
According to this link:

http://linux.die.net/man/7/pthreads

The NPTL (Native Posix Thread Lib - which most Linux disros use now) is 
implemented using clone(2) for creation and futex(2) for synchronization.


So maybe the question then becomes "How is clone(2) implementated in LInux"?


In terms of where the implementation is located - I think you need to 
download both glibc and kernel sources, as I think there are thread 
specific modules in both.


regards

Mark




More information about the ubuntu-users mailing list