Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does nptl work with pthreads ( 7 )?


Asked by Marley Tran on Dec 10, 2021 FAQ



NPTL With NPTL, all of the threads in a process are placed in the same thread group; all members of a thread group share the same PID. NPTL does not employ a manager thread. NPTL makes internal use of the first two real-time signals; these signals cannot be used in applications. See nptl (7) for further details.
Moreover,
By comparison with LinuxThreads, NPTL provides closer conformance to the requirements of the POSIX.1 specification and better performance when creating large numbers of threads. NPTL is available since glibc 2.3.2, and requires features that are present in the Linux 2.6 kernel.
Also, LinuxThreads The notable features of this implementation are the following: - In addition to the main (initial) thread, and the threads that the program creates using pthread_create (3), the implementation creates a "manager" thread. This thread handles thread creation and termination.
And,
This identifier is returned to the caller of pthread_create (3), and a thread can obtain its own thread identifier using pthread_self (3) . Thread IDs are guaranteed to be unique only within a process. (In all pthreads functions that accept a thread ID as an argument, that ID by definition refers to a thread in the same process as the caller.)
Consequently,
In NPTL, thread synchronization primitives (mutexes, thread joining, and so on) are implemented using the Linux futex (2) system call.