Native POSIX Thread Library
   HOME

TheInfoList



OR:

The Native POSIX Thread Library (NPTL) is an implementation of the
POSIX Threads POSIX Threads, commonly known as pthreads, is an execution model that exists independently from a language, as well as a parallel execution model. It allows a program to control multiple different flows of work that overlap in time. Each flow of ...
specification for the
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
operating system.


History

Before the 2.6 version of the
Linux kernel The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
, processes were the schedulable entities, and there were no special facilities for threads. However, it did have a system call — — which creates a copy of the calling process where the copy shares the address space of the caller. The
LinuxThreads In the Linux operating system, LinuxThreads was a partial implementation of POSIX Threads introduced in 1996. The main developer of LinuxThreads was Xavier Leroy. It has been superseded by the Native POSIX Thread Library (NPTL). LinuxThreads had ...
project used this system call to provide kernel-level threads (most of the previous thread implementations in Linux worked entirely in userland). Unfortunately, it only partially complied with POSIX, particularly in the areas of signal handling, scheduling, and inter-process synchronization primitives. To improve upon LinuxThreads, it was clear that some kernel support and a new threading library would be required. Two competing projects were started to address the requirement: NGPT (Next Generation POSIX Threads) worked on by a team which included developers from IBM, and NPTL by developers at
Red Hat Red Hat, Inc. is an American software company that provides open source software products to enterprises. Founded in 1993, Red Hat has its corporate headquarters in Raleigh, North Carolina, with other offices worldwide. Red Hat has become ass ...
. The NGPT team collaborated closely with the NPTL team and combined the best features of both implementations into NPTL. The NGPT project was subsequently abandoned in mid-2003 after merging its best features into NPTL. NPTL was first released in Red Hat Linux 9. Old-style Linux POSIX threading is known for having trouble with threads that refuse to yield to the system occasionally, because it does not take the opportunity to preempt them when it arises, something that Windows was known to do better at the time. Red Hat claimed that NPTL fixed this problem in an article on the
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
website about Java on Red Hat Linux 9. NPTL has been part of
Red Hat Enterprise Linux Red Hat Enterprise Linux (RHEL) is a commercial open-source Linux distribution developed by Red Hat for the commercial market. Red Hat Enterprise Linux is released in server versions for x86-64, Power ISA, ARM64, and IBM Z and a desktop version ...
since version 3, and in the Linux kernel since version 2.6. It is now a fully integrated part of the
GNU C Library The GNU C Library, commonly known as glibc, is the GNU Project's implementation of the C standard library. Despite its name, it now also directly supports C++ (and, indirectly, other programming languages). It was started in the 1980s by ...
.GNU C Library version 2.3.3 release
/ref> There exists a tracing tool for NPTL, calle
POSIX Thread Trace ToolPTT
. And a
Open POSIX Test SuiteOPTS
was written for testing the NPTL library against the POSIX standard.


Design

Like LinuxThreads, NPTL is a 1:1 threads library. Threads created by the library (via ''pthread_create'') correspond one-to-one with schedulable entities in the kernel (''processes'', in the Linux case). This is the simplest of the three threading models (1:1, N:1, and M:N). New threads are created with the clone() system call called through the NPTL library. NPTL relies on kernel support for
futex In computing, a futex (short for "fast userspace mutex") is a kernel system call that programmers can use to implement basic locking, or as a building block for higher-level locking abstractions such as semaphores and POSIX mutexes or condition ...
es to more efficiently implement user-space locks.


See also

*
LinuxThreads In the Linux operating system, LinuxThreads was a partial implementation of POSIX Threads introduced in 1996. The main developer of LinuxThreads was Xavier Leroy. It has been superseded by the Native POSIX Thread Library (NPTL). LinuxThreads had ...
*
Library (computer science) In computer science, a library is a collection of non-volatile resources used by computer programs, often for software development. These may include configuration data, documentation, help data, message templates, pre-written code and subr ...
* Green threads


References


External links


NPTL Trace Tool
OpenSource tool to trace and debug multithreaded applications using the NPTL. {{DEFAULTSORT:Native Posix Thread Library Linux kernel C POSIX library Threads (computing)