Optimizing C Multithreaded Memory Management Using Thread-Local Storage [chapter]

Yair Sade, Mooly Sagiv, Ran Shaham
2005 Lecture Notes in Computer Science  
Dynamic memory management in C programs can be rather costly. Multithreading introduces additional synchronization overhead of C memory management functions (malloc, free). In order to reduce this overhead, we extended Hoard -a state of the art memory allocator with the ability to allocate thread-local storage. Experimental results using the tool show runtime saving of up to 44% for a set of memory management benchmarks. To allow transparent usage of thread-local storage, we develop a
more » ... me algorithm, which conservatively detects allocation sites that can be replaced by thread-local allocations. Our static analysis is sound, i.e., every detected threadlocal storage is indeed so, although we may fail to identify opportunities for allocating thread-local storage. Technically, we reduce the problem of estimating thread-local storage to the problem of escape analysis and provide an efficient escape analysis for C. We solve the problem of escape analysis for C using existing points-to analysis algorithms. Our solution is parameterized by the points-to information. We empirically evaluated the solution with two different methods for computing points-to information. The usage of scalable points-to analysis algorithms and the fact that our reduction is efficient, guarantees that our static analysis technique is scalable.
doi:10.1007/978-3-540-31985-6_10 fatcat:xsgm7tr5xzelbajtissjcdribi