Scalable reader-writer locks

  • Authors:
  • Yossi Lev;Victor Luchangco;Marek Olszewski

  • Affiliations:
  • Brown University and Sun Microsystems Laboratories, Burlington, MA, USA;Sun Microsystems Laboratories, Burlington, MA, USA;Massachusetts Institute of Technology and Sun Microsystems Laboratories, Burlington, MA, USA

  • Venue:
  • Proceedings of the twenty-first annual symposium on Parallelism in algorithms and architectures
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present three new reader-writer lock algorithms that scale under high read-only contention. Many previous reader-writer locks suffer significant degradation when many readers attempt to acquire the lock concurrently, even though they are all allowed to hold the lock at the same time. In contrast, our locks scale almost perfectly when there is only read contention on a 4-chip system with a total of 256 hardware threads. Two of the algorithms extend the MCS queue mutex to provide reader-writer synchronization with low overhead, and can be used when busy-waiting synchronization is appropriate. The third algorithm is an improvement on a production-quality reader-writer lock used in the SolarisTM kernel, which provides robust priority and flexible fairness guarantees. A key tool we developed to implement our reader-writer locks is the closable scalable nonzero indicator (C-SNZI), a variation on the SNZI object. C-SNZI objects allow us to significantly reduce the contention among reads when many readers try to acquire the lock concurrently, but keeps the acquisition overhead small in the absence of read contention. We present an algorithm for C-SNZI that achieves this goal, and show how it can be used by each of our lock algorithms to provide scalable reader-writer locks with different fairness guarantees.