International Journal of Parallel Programming

, Volume 43, Issue 5, pp 721–751

Queue-Based and Adaptive Lock Algorithms for Scalable Resource Allocation on Shared-Memory Multiprocessors

Article

DOI: 10.1007/s10766-014-0317-6

Cite this article as:
Zhang, D., Lynch, B. & Dechev, D. Int J Parallel Prog (2015) 43: 721. doi:10.1007/s10766-014-0317-6
  • 147 Downloads

Abstract

We present a scalable lock algorithm and an adaptive scheme for shared-memory multiprocessors addressing the resource allocation problem, which is also known as the \(h\)-out-of-\(k\) mutual exclusion problem. In this problem, threads compete for \(k\) shared resources where a thread may request an arbitrary number \(1\le h\le k\) of resources at the same time. The challenge is for each thread to acquire exclusive access to desired resources while preventing deadlock or starvation. Many existing approaches solve this problem in a distributed system, but the explicit message passing paradigm they adopt is not optimal for shared-memory. Other applicable methods, like two-phase locking and resource hierarchy, suffer from performance degradation under heavy contention, while lacking a desirable fairness guarantee. This work describes the first multi-resource lock algorithm that guarantees the strongest first-in, first-out fairness. Our methodology is based on a non-blocking queue where competing threads spin on previous conflicting resource requests. In our experimental evaluation we compared the overhead and scalability of our lock to the best available alternative approaches using a micro-benchmark. As contention increases, our multi-resource lock obtains an average of eight times speed-up over the alternatives including GNU C++’s lock method, Boost’s lock function, and Intel TBB’s queue mutex. To further improve the performance on low levels of contention, we introduce an adaptive scheme that is composed of two different lock algorithms and alternates the use the locks depending on the level of contention. Our experimental results show that the composite adaptive scheme achieves the best overall performance comparing with using either lock alone when system contention is not known a priori.

Keywords

\(H\)-out-of-\(k\) mutual exclusion Lock-free programming  Queue-based lock Resource allocation 

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  1. 1.University of Central FloridaOrlandoUSA

Personalised recommendations