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

Edmon Begoli
Thu Mar 24 14:40:00 GMT 2011

Thank you all.

Would you please instruct me on two things:

- what exact command should I run to get as succinct version of the
assembler generated
for the small snippet of pthreads code (similar to the one below).
I was using gcc -phtread -S -O2 -fdump-tree-all -fverbose-asm <filename>.c

- would you please give me some pointers to source code as to where to
look exactly to understand the specifics on how is pthreads code
compiled by the gcc

Furthermore - it seems that it would be worthwhile to write a paper on
this topic given the absence
of formal documentation, so if anyone is interested in collaborating
on the paper that we would submit to
some compilers journal please let me know.

Thank you in advance,

On Thu, Mar 24, 2011 at 5:27 AM, Florian Weimer <> wrote:
> * 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                <>
> BFK edv-consulting GmbH
> Kriegsstraße 100              tel: +49-721-96201-1
> D-76133 Karlsruhe             fax: +49-721-96201-99

More information about the Libc-help mailing list