Pthreads and Linux

Of course, Linux wanted to be compliant with the POSIX threads standard; but who would actually build an implementation (remember, the standard is merely a draft specification document; it's not code)? Back in 1996, Xavier Leroy stepped up and built Linux's first pthreads implementation—a threading library called Linux threads. All considered, it was a good effort, but was not fully compatible with the (then brand new) pthreads standard.

An early effort at resolving problems was called Next Generation Posix Threads (NGPT). At around the same time, Red Hat threw in a team to work on this area as well; they called the project Native Posix Threading Library (NPTL). In the best traditions of open source culture, the NGPT developers worked together with their counterparts at NPTL and began merging the best features of NGPT into NPTL. NGPT development was abandoned sometime in 2003;  by then, the realistic implementation of pthreads on Linux—which remains to this day—is NPTL. 

More technically: NPTL was entrenched as the superior threading API interface, even as features were integrated into the 2.6 Linux kernel (December 2003 onward), which helped greatly improve threading performance. 

NPTL implements the 1:1 threading model; this model provides true multithreading (user and kernel state) and is also known as the native threads model. Here, we do not intend to delve into these internal details; a link has been provided for interested readers in the Further reading section on the GitHub repository.

One can look up the threading implementation (since glibc 2.3.2) with the following code (on a Fedora 28 system):

$ getconf GNU_LIBPTHREAD_VERSION
NPTL 2.27
$

Clearly, it's NPTL.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset