This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Help for graduate research - how are NLTP routines implemented atthe OS level
On Sat, Mar 19, 2011 at 6:32 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday, March 19, 2011 17:46:18 Edmon Begoli wrote:
>> I need help understanding what system calls are used to implement
>> mutexes and context switches.
>
> you probably want to google futexes. ?drepper wrote some stuff on it too iirc.
> try http://people.redhat.com/drepper/
>
> in fact, simply googling for "nptl design" shows some good hits.
>
>> I am interested in knowing specifically how is pthread_mutex_lock and
>> unlock implemented and what OS system calls are used for context
>> switching (longjmp/setjmp?).
>
> there arent any syscalls used for context switching, and certainly not
> setjmp/longjmp. ?the threads are handled by the linux kernel.
Just for some more context.
The Linux kernel and GLIBC have a 1:1 threading model. There are M
kernel threads that match up with M userspace threads.
Unlike for example, Solaris whose historical default has been an M:N
implementation where multiple user threads were tied to one kernel
process, which is scheduled by the kernel.
IIRC anything newer than Solaris 8/9 can use a 1:1 model, and it's is
the preferred model.
For a whitepaper about the change see:
http://www.sun.com/software/whitepapers/solaris9/multithread.pdf
Cheers,
Carlos.