This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help for graduate research - how are NLTP routines implemented at the OS level


* Edmon Begoli:

> How does compiler translate a following line of code into something
> that operating system will recognize as an instruction that will map
> to an OS thread:
>
> ret_value = pthread_create( &thread1, NULL, print_message_function,
>   (void*) message1);

The pthread API only needs very limited compiler support (certain
optimizations are invalid in multithreaded programs).  Portable C code
does not care whether it runs on the main thread or additional threads
created by pthread_create.

The actual thread creation happens in the kernel and in an assembler
helper which set up the initial stack frame for the new thread.  And
there are some bookkeeping structures which need to be updated,
e.g. to allow iterating over all threads in the process.

-- 
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]