Skip to Main content Skip to Navigation
Journal articles

Lock–Unlock: Is That All? A Pragmatic Analysis of Locking in Software Systems

Abstract : A plethora of optimized mutex lock algorithms have been designed over the past 25 years to mitigate performance bottlenecks related to critical sections and locks. Unfortunately, there is currently no broad study of the behavior of these optimized lock algorithms on realistic applications that consider different performance metrics, such as energy efficiency and tail latency. In this article, we perform a thorough and practical analysis of synchronization, with the goal of providing software developers with enough information to design fast, scalable, and energy-efficient synchronization in their systems. First, we perform a performance study of 28 state-of-the-art mutex lock algorithms, on 40 applications, on four different multicore machines. We consider not only throughput (traditionally the main performance metric) but also energy efficiency and tail latency, which are becoming increasingly important. Second, we present an in-depth analysis in which we summarize our findings for all the studied applications. In particular, we describe nine different lock-related performance bottlenecks, and we propose six guidelines helping software developers with their choice of a lock algorithm according to the different lock properties and the application characteristics. From our detailed analysis, we make several observations regarding locking algorithms and application behaviors, several of which have not been previously discovered: (i) applications stress not only the lockunlock interface but also the full locking API (e.g., trylocks, condition variables); (ii) the memory footprint of a lock can directly affect the application performance; (iii) for many applications, the interaction between locks and scheduling is an important application performance factor; (vi) lock tail latencies may or may not affect application tail latency; (v) no single lock is systematically the best; (vi) choosing the best lock is difficult; and (vii) energy efficiency and throughput go hand in hand in the context of lock algorithms. These findings highlight that locking involves more considerations than the simple lock/unlock interface and call for further This project started while V. Trigonakis was at EPFL. This work was partially supported by LabEx PERSYVAL-Lab (ANR-11-LABX-0025-01), the EmSoc "Replicanos" and AGIR "CAEC" projects of the University of Grenoble Alpes and Grenoble INP, the FSN OCCIware project, the "Studio virtuel" project funded by BPI and FEDER grant agreement no. 16.010402.01, the "RainbowFS" project of Agence Nationale de la Recherche (ANR-16-CE25-0013-01), and the European ERC GRANT 339539-AOC. Some of the experiments presented in this article were carried out using the Digitalis platform ( of the Grid'5000 testbed. Grid'5000 is supported by a scientific interest group hosted by Inria and including CNRS, RENATER, and several universities, as well as other organizations ( Access to the experimental machine(s) used in this article was gracefully granted by research teams from LIG ( and Inria ( The A-48 machine was funded by a Grenoble INP project led by the Mescal, Moais, and Erods teams of LIG. The injection machine used with the A-48 machine is a reused machine of the former Pipol Cluster (continuous integration) of Inria Grenoble Rhone-Alpes (dismantled).
Document type :
Journal articles
Complete list of metadata
Contributor : Hugo Guiroux Connect in order to contact the contributor
Submitted on : Wednesday, April 28, 2021 - 11:52:22 AM
Last modification on : Wednesday, November 3, 2021 - 5:59:06 AM
Long-term archiving on: : Thursday, July 29, 2021 - 6:01:15 PM


Files produced by the author(s)



Rachid Guerraoui, Hugo Guiroux, Renaud Lachaize, Vivien Quéma, Vasileios Trigonakis. Lock–Unlock: Is That All? A Pragmatic Analysis of Locking in Software Systems. ACM Transactions on Computer Systems, Association for Computing Machinery, 2019, 36 (1), pp.1-149. ⟨10.1145/3301501⟩. ⟨hal-02084060⟩



Record views


Files downloads