Facebook Twitter Instagram
    WiredRevolution.com
    • Home
    • About
    • Contact Us
    • Essential Linux Commands
    • Sitemap
    Facebook Twitter Instagram
    WiredRevolution.com
    system administration

    Select threading implementation using LD_ASSUME_KERNEL

    RyanBy RyanOctober 13, 2008Updated:October 13, 20082 Mins Read
    Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Email

    For backwards compatibility, many Linux distributions support both the older LinuxThreads implementation as well as the newer Native POSIX Thread Library (NPTL). By setting the LD_ASSUME_KERNEL environment variable you can tell the dynamic linker to assume that it is running on top of a particular kernel version. This will override the dynamic linker’s default choice of threading implementation (usually NPTL) and force the use of the older LinuxThreads implementation at run-time.

    Many 32-bit systems have 3 separate glibc versions which have support for a minimum OS Application Binary Interface (ABI), designated by a kernel version and offer support for a particular thread implementation.

    /lib/tls/libc.so.6

    • minimum ABI = 2.4.20
    • Native POSIX Thread Library (NPTL)

    /lib/i686/libc.so.6

    • minimum ABI = 2.4.1
    • standard LinuxThreads

    /lib/libc.so.6

    • minimum ABI = 2.2.5
    • early LinuxThreads code which had fixed size threads

    It is worth noting that 64-bit systems do not support the older 2.2.5 LinuxThreads implementation.

    You can run the following commands to see what thread implementations are supported by each separate glibc library.

    $ /lib/tls/libc.so.6 | grep [T|t]hreads
    
    	Native POSIX Threads Library by Ulrich Drepper
    
    $ /lib/i686/libc.so.6 | grep [T|t]hreads
    
    	linuxthreads-0.10 by Xavier Leroy
    
    $ /lib/libc.so.6 | grep [T|t]hreads
    
    	linuxthreads-0.10 by Xavier Leroy
    

    A shared library can tell the dynamic linker which minimum OS ABI version is needed for it to successfully run. At run-time the linker will start at the most recent library path and walk backwards in this order: /lib/tls, /lib/i686, /lib. It will either link to the first library it finds or fail and terminate the program if the minimum ABI is reached before it finds a library.

    Setting LD_ASSUME_KERNEL below the minimum threshold ABI version of any dynamic library will cause the linker to skip that library and try to find an older implementation

    Set the environment variable by assigning it to a specific ABI/kernel version.

    $ export LD_ASSUME_KERNEL=X.Y.Z
    

    You must be careful not to set the the ABI below 2.2.5 in your environment as all programs which require dynamic linking will probably fail to run. Luckily you are still be able to unset or change it back.

    It is useless to set LD_ASSUME_KERNEL for most programs as they will run correctly no matter what underlying implementation is used since the API is the same. However there are some programs that may depend on some non-conformant behavior requiring LinuxThreads, which will fail with NPTL.

    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Email
    Previous ArticleUpdate your entire Gentoo Linux system
    Next Article Display the last part of a file with tail

    Related Posts

    Install Virtualbox on Ubuntu 12.10: the missing kernel module fix

    The Linux Kernel Reaches Milestone Version 3.0

    Find the PID of the current Bash script

    Most Commented
    March 12, 2009

    Fix blue tinted video in Ubuntu

    September 10, 2010

    Setup SSH access between VirtualBox Host and Guest VMs

    March 8, 2011

    Install GNOME Shell in Ubuntu 10.10 Maverick

    April 4, 2009

    Setup the PS3 Bluetooth Controller on Ubuntu

    October 22, 2008

    How to correctly use LD_LIBRARY_PATH

    Recent Comments
    • Execute command on linux virtual machine (or server) from windows commandline on Setup SSH access between VirtualBox Host and Guest VMs
    • Solved: How to SSH to a VirtualBox guest externally through a host? - Daily Developer Blog on Setup SSH access between VirtualBox Host and Guest VMs
    • How to SSH to a VirtualBox guest externally through a host? [closed] – Code D3 on Setup SSH access between VirtualBox Host and Guest VMs
    • How to copy and paste from VirtualBox? [duplicate] on Setup SSH access between VirtualBox Host and Guest VMs
    • Jackie Laguna on Fix OpenGL: ChoosePixelFormat SketchUp error in WINE
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.