What are the definitions and differences among:
Linux thread,
NPTL
POSIX
GLibC
pthread
??
I am totally confused by their relationships...
Printable View
What are the definitions and differences among:
Linux thread,
NPTL
POSIX
GLibC
pthread
??
I am totally confused by their relationships...
If I could, I'd draw a Venn diagram. The most general of these terms is glibc, which is a C library which implements POSIX as well as other things. POSIX is an overarching standard for UNIX-like user APIs. Pthreads is a part of POSIX. NPTL is an implementation of Pthreads. Linux Threads is a different implementation of Pthreads.
So, the concepts are nested this way:
glibc (posix (pthreads (ntpl, linuxthreads) ) )
Note that POSIX and pthreads are standards (well, especially POSIX). The other things mentioned are specific libraries or (in the case of NPTL and Linux Threads) implementations of standards.
It's like the difference between a "laptop" and a "Toshiba". A laptop is a general thing, while a Toshiba is a specific instance of a laptop. (Or can be.)
An interested read:
Linux threading models compared: LinuxThreads and NPTLgg
Thanks all. That is to say, the code to use thread can be the same even if you migrate your system from linuxthread to NPTL. Say, you can use pthread_create(...) to create a thread and the code (even binary) doesn't need to be changed, because glibc is dynamically linked.
That may be true for glibc functions - but I don't think pthread_create() is in there. If you are migrating from LinuxThreads to NPTL, then a re-build will be needed.
gg
Are you sure? pthreads on Linux comes from libpthread.so, so it might just be drop-in replaceable, assuming NPTL also lives in a library called "libpthread.so," or you could at least symlink it to make it appear so.
I don't guarantee it would work, but if I were designing a new pthreads library, I'd try to make it possible to do this.