Comparison of Linux threading models: Linuxthreads and NPTL

Source: Internet
Author: User

Comparison of Linux threading models: Linuxthreads and NPTL

GNU_LIBPTHREAD_VERSION macro

Most modern Linux distributions have linuxthreads and NPTL preinstalled, so they provide a mechanism to switch between the two. To see which line libraries is being used on your system, run the following command:

$ getconf GNU_LIBPTHREAD_VERSION

This produces output similar to the following:

NPTL 0.34

Or:

linuxthreads-0.10

The threading model, glibc version, and kernel version used by the Linux distribution

Table 1 lists some of the popular Linux distributions, as well as the types of threading implementations they employ, the GLIBC library, and the kernel version.

table 1. Linux distributions and their threading implementations
Thread Implementation C Library Release version Kernel
Linuxthreads 0.7, 0.71 (for Libc5) LIBC 5.x Red Hat 4.2
Linuxthreads 0.7, 0.71 (for glibc 2) GLIBC 2.0.x Red Hat 5.x
Linuxthreads 0.8 GLIBC 2.1.1 Red Hat 6.0
Linuxthreads 0.8 GLIBC 2.1.2 Red Hat 6.1 and 6.2
Linuxthreads 0.9 Red Hat 7.2 2.4.7
Linuxthreads 0.9 GLIBC 2.2.4 Red Hat 2.1 as 2.4.9
Linuxthreads 0.10 GLIBC 2.2.93 Red Hat 8.0 2.4.18
NPTL 0.6 GLIBC 2.3 Red Hat 9.0 2.4.20
NPTL 0.61 GLIBC 2.3.2 Red Hat 3.0 EL 2.4.21
NPTL 2.3.4 GLIBC 2.3.4 Red Hat 4.0 2.6.9
Linuxthreads 0.9 GLIBC 2.2 SUSE Linux Enterprise Server 7.1 2.4.18
Linuxthreads 0.9 GLIBC 2.2.5 SUSE Linux Enterprise Server 8 2.4.21
Linuxthreads 0.9 GLIBC 2.2.5 The Linux 2.4.21
NPTL 2.3.5 GLIBC 2.3.3 SUSE Linux Enterprise Server 9 2.6.5

Note that starting with the 2.6.x kernel and glibc 2.3.3, the version number naming convention used by NPTL has changed: The library is now numbered based on the version of glibc used.

The Java™ virtual machine (JVM) support may be slightly different. IBM's JVM can support most of the distributions in table 1, glibc versions above 2.1.

Back to top of page

Conclusion

The limitations of linuxthreads have been overcome in NPTL and in some versions of the late Linuxthreads. For example, the latest Linuxthreads implementation uses thread registration to locate thread-local data, for example, on an Intel® processor, it uses the %fs and %gs segment registers to locate the virtual address used to access thread-local data. While this result shows some of the improvements that Linuxthreads has adopted, it still has a lot of problems with higher load and stress testing because it relies too much on a management thread to use it for signal processing.

You should keep in mind that when you use Linuxthreads to build libraries, you need to use -D_REENTRANT compile-time flags. This makes the library thread secure.

Finally, perhaps the most important thing to remember is that the creators of the Linuxthreads project are no longer actively updating it, and they think NPTL will replace Linuxthreads.

The disadvantage of linuxthreads does not mean that NPTL is not wrong. As an SMP-oriented design, NPTL also has some drawbacks. I've seen this problem on the nearest Red Hat kernel: A simple thread works well on a single-processor machine, but hangs on an SMP machine. I believe there is more work to be done on Linux to make it more scalable to meet the needs of high-end applications.

Comparison of Linux threading models: Linuxthreads and NPTL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.