Advertisement

A Hierarchical CLH Queue Lock

  • Victor Luchangco
  • Dan Nussbaum
  • Nir Shavit
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4128)

Abstract

Modern multiprocessor architectures such as CC-NUMA machines or CMPs have nonuniform communication architectures that render programs sensitive to memory access locality. A recent paper by Radović and Hagersten shows that performance gains can be obtained by developing general-purpose mutual-exclusion locks that encourage threads with high mutual memory locality to acquire the lock consecutively, thus reducing the overall cost due to cache misses. Radović and Hagersten present the first such hierarchical locks. Unfortunately, their locks are backoff locks, which are known to incur higher cache miss rates than queue-based locks, suffer from various fundamental fairness issues, and are hard to tune so as to maximize locality of lock accesses.

Extending queue-locking algorithms to be hierarchical requires that requests from threads with high mutual memory locality be consecutive in the queue. Until now, it was not clear that one could design such locks because collecting requests locally and moving them into a global queue seemingly requires a level of coordination whose cost would defeat the very purpose of hierarchical locking.

This paper presents a hierarchical version of the Craig, Landin, and Hagersten CLH queue lock, which we call the HCLH queue lock. In this algorithm, threads build implicit local queues of waiting threads, splicing them into a global queue at the cost of only a single CAS operation.

In a set of microbenchmarks run on a large scale multiprocessor machine and a state-of-the-art multi-threaded multi-core chip, the HLCH algorithm exhibits better performance and significantly better fairness than the hierarchical backoff locks of Radović and Hagersten.

Keywords

Critical Section Cache Line Pred Variable Critical Work Spin Lock 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Anderson, T.: The performance implications of spin lock alternatives for shared-memory multiprocessors. IEEE Trans. Parallel and Distributed Systems 1(1), 6–16 (1990)CrossRefGoogle Scholar
  2. 2.
    Craig, T.: Building FIFO and priority-queueing spin locks from atomic swap. Technical Report TR 93-02-02, University of Washington, Dept of Computer Science (1993)Google Scholar
  3. 3.
    Mellor-Crummey, J., Scott, M.: Algorithms for scalable synchronization on shared-memory multiprocessors. ACM Trans. Computer Systems 9(1), 21–65 (1991)CrossRefGoogle Scholar
  4. 4.
    Magnussen, P., Landin, A., Hagersten, E.: Queue locks on cache coherent multiprocessors. In: Proc. 8th International Symposium on Parallel Processing (IPPS), pp. 165–171 (1994)Google Scholar
  5. 5.
    Agarwal, A., Cherian, M.: Adaptive backoff synchronization techniques. In: Proc. 16th International Symposium on Computer Architecture, pp. 396–406 (1989)Google Scholar
  6. 6.
    Radović, Z., Hagersten, E.: Hierarchical Backoff Locks for Nonuniform Communication Architectures. In: HPCA-9, Anaheim, California, USA, pp. 241–252 (2003)Google Scholar
  7. 7.
    Sun Microsystems: Sun Fire E25K/E20K Systems Overview. Technical Report 817-4136-12, Sun Microsystems (2005)Google Scholar
  8. 8.
    Kongetira, P., Aingaran, K., Olukotun, K.: Niagara: A 32-way multithreaded sparc processor. IEEE Micro 25(2), 21–29 (2005)CrossRefGoogle Scholar
  9. 9.
    Scott, M., Scherer, W.: Scalable queue-based spin locks with timeout. In: Proc. 8th ACM SIGPLAN Symposium on Principles and Practices of Parallel Programming, pp. 44–52 (2001)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Victor Luchangco
    • 1
  • Dan Nussbaum
    • 1
  • Nir Shavit
    • 1
  1. 1.Sun Microsystems Laboratories 

Personalised recommendations