Comparison of lock thrashing avoidance methods and its performance implications for lock design

  • Authors:
  • Yan Cui;Yu Chen;Yuanchun Shi

  • Affiliations:
  • Tsinghua, Beijing, China;Tsinghua, Beijing, China;Tsinghua, Beijing, China

  • Venue:
  • Proceedings of the third international workshop on Large-scale system and application performance
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Multicore processors have been ubiquitously used in various computing environments. To achieve the performance potential on multicores, applications are often designed to be multithreaded, therefore threads assigned on different cores can execute in parallel. However, the lock contention in operating systems can degrade the scalability of applications so seriously that the overall throughput decreases with the increasing number of cores (lock thrashing) even if there is no data sharing in applications. Many classical solutions have been widely known as the most effective ways to reduce the lock contention. However, the effectiveness of these methods in reducing lock thrashing on large scale multicores is not well known. Therefore, we choose three popular lock thrashing avoidance methods (mutex lock, adaptive mutex lock and scalable spinlock) to explore the answer and investigate how effective they are. Evaluation results using both micro- and macro-benchmarks on an AMD 32-core platform indicate that although different methods can reduce the lock thrashing to different extents, there is still plenty of room for improvement. Further, we analyze the lock characteristics of four different workloads using a discrete event simulation model. Using our observations, we propose a new, adaptive parallel lock (APlock). APlock has the ability of tuning the number of cores waiting for a lock adaptively, aiming to minimize lock thrashing on multicores.