High‐contention mutual exclusion by elevator algorithms

This paper presents new starvation‐free hardware‐assisted and software‐only algorithms for the N‐thread mutual‐exclusion problem. The hardware‐assisted versions use a single atomic‐CAS instruction and no fences. The software‐only algorithms simulate the CAS instruction using a variation of Burns‐Lamport (1 fence) or Lamport's fast algorithm (3 fences). The algorithms are based on Attiya et al, where every thread in the critical section chooses its successor (if one is available). While Attiya et al use a binary tree for this purpose, it can also be done with a linear search. Surprisingly, all software‐only algorithms perform equally well under maximal contention on three different computer architectures; the hardware‐assisted versions perform better under minimal contention. The new algorithms are between −5% to 50% slower for maximal contention than the starvation‐free first‐come first‐served hardware‐assisted MCS algorithm, which uses two atomic instructions (fetch‐store and CAS); they are between 10% to 50% slower than MCS for minimal contention.

[1]  Jayadev Misra,et al.  A discipline of multiprogramming: programming theory for distributed applications , 2001 .

[2]  Thomas E. Anderson,et al.  The Performance of Spin Lock Alternatives for Shared-Memory Multiprocessors , 1990, IEEE Trans. Parallel Distributed Syst..

[3]  Wim H. Hesselink Mutual exclusion by four shared bits with not more than quadratic complexity , 2015, Sci. Comput. Program..

[4]  K. Mani Chandy,et al.  Parallel program design - a foundation , 1988 .

[5]  Michael L. Scott,et al.  Algorithms for scalable synchronization on shared-memory multiprocessors , 1991, TOCS.

[6]  Gregory R. Andrews,et al.  A Method for Solving Synchronization Problems , 1989, Sci. Comput. Program..

[7]  Leslie Lamport,et al.  The mutual exclusion problem: partII—statement and solutions , 1986, JACM.

[8]  Wim H. Hesselink Progress under bounded fairness , 1999, Distributed Computing.

[9]  Sarita V. Adve,et al.  Shared Memory Consistency Models: A Tutorial , 1996, Computer.

[10]  David Dice,et al.  Dekker's mutual exclusion algorithm made RW‐safe , 2016, Concurr. Comput. Pract. Exp..

[11]  Wim H. Hesselink,et al.  Tournaments for mutual exclusion: verification and concurrent complexity , 2017, Formal Aspects of Computing.

[12]  David Dice,et al.  Fast mutual exclusion by the Triangle algorithm , 2018, Concurr. Comput. Pract. Exp..

[13]  Nancy A. Lynch,et al.  Mutual exclusion using indivisible reads and writes , 1980 .

[14]  David Dice,et al.  High‐performance N‐thread software solutions for mutual exclusion , 2015, Concurr. Comput. Pract. Exp..

[15]  Edsger W. Dijkstra,et al.  Co-operating sequential processes , 1968 .

[16]  Leslie Lamport,et al.  The mutual exclusion problem: part II - Statement and solutions , 2019, Concurrency: the Works of Leslie Lamport.

[17]  Leslie Lamport,et al.  The mutual exclusion problem: part I—a theory of interprocess communication , 1986, JACM.

[18]  Danny Hendler,et al.  An O(1)-barriers optimal RMRs mutual exclusion algorithm: extended abstract , 2013, PODC '13.

[19]  Edsger W. Dijkstra,et al.  Solution of a problem in concurrent programming control , 1965, CACM.

[20]  Leslie Lamport,et al.  A fast mutual exclusion algorithm , 1987, TOCS.

[21]  Stein Gjessing,et al.  Hardware support for synchronization in the Scalable Coherent Interface (SCI) , 1994, Proceedings of 8th International Parallel Processing Symposium.

[22]  Vassos Hadzilacos,et al.  A first-come-first-served mutual-exclusion algorithm with small communication variables , 1991, TOPL.