I am confused by "Linux thread" and "NPTL"

This is a discussion on I am confused by "Linux thread" and "NPTL" within the Linux Programming forums, part of the Platform Specific Boards category; What are the definitions and differences among: Linux thread, NPTL POSIX GLibC pthread ?? I am totally confused by their ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    284

    I am confused by "Linux thread" and "NPTL"

    What are the definitions and differences among:
    Linux thread,
    NPTL
    POSIX
    GLibC
    pthread
    ??
    I am totally confused by their relationships...

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    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) ) )

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    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.)
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    284
    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.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702
    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

  7. #7
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    Quote Originally Posted by Codeplug View Post
    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.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21