Speeding Up Thread-Local Storage Access in Dynamic Libraries

2005 
As multi-core processors become the rule rather than the exc eption, multi-threaded programming is expected to expand from its current niches to more widespread use, in software components that have not traditionally been concerned about exploiting concurr ency. Accessing thread-local storage (TLS) from within dynamic libraries has traditionally required calling a function to obtain the threadlocal address of the variable. Such function calls are sever al times slower than typical addressing code that is used in executables. While instructions used in executables can assume thread-local variables are at a constant offset within the thread Static T LS block, dynamic libraries loaded during program execution may not even assume that their thread-local variables are in Static TLS b locks. Since libraries are most commonly loaded as dependencies of executables or other libraries, before a program starts runnin g, the most common TLS case is that of constant offsets. This paper proposes an access model that enables dynamic libraries to take advantage of this fact, without giving up the ability to be loaded durin g program execution. This new model was implemented and tested on GNU/Linux systems, initially on the Fujitsu FR-V architecture, and later on IA32 and AMD64/EM64T, such that performance could be compared with that of the existing models. Experimental results revealed the new model consistently exceeds the old model in terms of performance, particularly in the most common case, where the speedup is often well over 100%, bringing it nearly to the same performance of access models used in plain executables.
    • Correction
    • Source
    • Cite
    • Save
    • Machine Reading By IdeaReader
    8
    References
    4
    Citations
    NaN
    KQI
    []