Native POSIX Thread Library
Before the 2.6 version of the Linux kernel, processes were the schedulable entities, and there were no special facilities for threads. However, it did have a system call — clone — which creates a copy of the calling process where the copy shares the address space of the caller. The LinuxThreads 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. 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 website about Java on Red Hat Linux 9.
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).: 226 This is the simplest of the three threading models (1:1, N:1, and M:N).: 215–216 New threads are created with the clone() system call called through the NPTL library. NPTL relies on kernel support for futexes to more efficiently implement user-space locks.: 182
- pthreads(7) — Linux manual page
- Red Hat Linux 9 and Java 2 Platform, Standard Edition 1.4.2: A Winning Combination
- GNU C Library version 2.3.3 release
- Robert Love (2013). Linux System Programming (2nd ed.). ISBN 1449339530.
- NPTL Trace Tool OpenSource tool to trace and debug multithreaded applications using the NPTL.