nptl(7)

โœจ nptl โ€” Native POSIX Threads Library โœจ

okay bestie, welcome to the nptl(7) page ๐Ÿ’– this is from the Miscellaneous Information Manual and it's all about the threading situation on your Linux box. it's giving "backbone of everything you've ever run" energy, fr fr.


๐ŸŒธ NAME ๐ŸŒธ

nptl โ€” Native POSIX Threads Library


๐ŸŽ€ DESCRIPTION ๐ŸŽ€

NPTL (Native POSIX Threads Library) is the GNU C library POSIX threads implementation that is used on modern Linux systems. that's it, that's the whole vibe โ€” she's the threading queen and she runs your entire system, no cap. ๐Ÿ‘‘

๐Ÿ’… NPTL and signals ๐Ÿ’…

so here's the tea, bestie: NPTL makes internal use of the first two real-time signals โ€” that's signal numbers 32 and 33. one of these signals is used to support thread cancelation and POSIX timers (peep timer_create(2) for that one); the other is used as part of a mechanism that ensures all threads in a process always have the same UIDs and GIDs, as required by POSIX. that's a whole lot of responsibility for two little signals tbh.

โš ๏ธ warning bestie: these signals cannot be used in applications. periodt. not yours to touch.

to prevent accidental use of these signals in applications โ€” which might interfere with the operation of the NPTL implementation โ€” various glibc library functions and system call wrapper functions attempt to hide these signals from applications, as follows:

likeโ€ฆ it's a whole protective-big-sister situation and honestly? iconic. ๐Ÿซถ

๐Ÿฆ‹ NPTL and process credential changes ๐Ÿฆ‹

ngl this part is lowkey fascinating. at the Linux kernel level, credentials (user and group IDs) are a per-thread attribute. but POSIX said "absolutely not, bestie" and requires that all of the POSIX threads in a process have the same credentials. slay, standards.

to accommodate this requirement, the NPTL implementation wraps all of the system calls that change process credentials with functions that, in addition to invoking the underlying system call, arrange for all other threads in the process to also change their credentials. so like, no thread gets left behind. ๐Ÿ’–

here's how it goes down, mechanically speaking:

the implementation of each of these system calls involves the use of a real-time signal that is sent (using tgkill(2)) to each of the other threads that must change its credentials. before sending these signals, the thread that is changing credentials saves the new credential(s) and records the system call being employed in a global buffer. then a signal handler in the receiving thread(s) fetches this information and then uses the same system call to change its credentials. chef's kiss coordination honestly ๐Ÿ‘‘

wrapper functions employing this technique are provided for:


โญ STANDARDS โญ

for details of the conformance of NPTL to the POSIX standard, see pthreads(7). (yes bestie, we're citing sources, we're being academic about it ๐Ÿ’œ)


๐ŸŒˆ NOTES ๐ŸŒˆ

POSIX says that any thread in any process with access to the memory containing a process-shared (PTHREAD_PROCESS_SHARED) mutex can operate on that mutex. sounds great, right?

BUT โ€” and this is the plot twist โ€” on 64-bit x86 systems, the mutex definition for x86-64 is incompatible with the mutex definition for i386, meaning that 32-bit and 64-bit binaries can't share mutexes on x86-64 systems. ๐Ÿ’€ so keep that in mind, fr fr.


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ


and that's the whole page, bestie!! ๐Ÿ’– this was nptl(7) from Linux man-pages 6.20, dated 2026-02-08. go forth and thread responsibly, you absolute main character ๐ŸŒธ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: Linux-man-pages-copyleft
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms