Nonblocking Algorithms

  • Chapter
  • First Online:
Shared-Memory Synchronization

Part of the book series: Synthesis Lectures on Computer Architecture ((SLCA))

  • 131 Accesses

Abstract

When devising a concurrent data structure, we typically want to arrange for methods to be atomic—most often linearizable (Sec. 3.1.2). Most concurrent algorithms achieve atomicity by means of mutual exclusion, implemented using locks. Locks are blocking, however, in the formal sense of the word: whether implemented by spinning or rescheduling, they admit system states in which a thread is unable to make progress without the cooperation of one or more peers. This in turn leads to the problems of inopportune preemption and convoys, discussed in Sec. 7.5.2. Locks—coarse-grain locks in particular—are also typically conservative: in the course of precluding unacceptable thread interleavings, they tend to preclude many acceptable interleavings as well.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
EUR 29.95
Price includes VAT (France)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
EUR 32.09
Price includes VAT (France)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
EUR 42.19
Price includes VAT (France)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free ship** worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    If the back pointer were changed before the node was deleted, then a cycle would be created in the list, and could remain in place indefinitely if the calling thread stalled or crashed. On the other hand, if the node were deleted first and then the thread stalled or crashed, the next pointer might remain unchanged indefinitely, and threads traversing the node would not have access to a back pointer.

  2. 2.

    The idea of “lock-free mutual exclusion” was introduced by Barnes (1993b) in his description of a “cooperative technique” for lock-free synchronization. One could sensibly view the EFRB tree as a specialization of Barnes’ approach that uses compare and swap instead of load-link/store-conditional, and has several distinct descriptor types. More recently, Ben-David et al. (2022) generalized and further formalized this idea. The specific flagging and marking techniques in the EFRB tree paper were inspired by earlier work by Fomitchev and Ruppert (2004).

  3. 3.

    Note that if descriptors are word-aligned on a 32-bit architecture, then the two least significant bits of any descriptor pointer are zero, so these two bits are conceptually free to store the state. On a 64-bit architecture, three bits are free.

  4. 4.

    When the insert restarts, it can either free or reuse the InsertFlag descriptor that it allocated, since the CAS failure means no other thread can have a pointer to that descriptor.

  5. 5.

    In this case, the descriptor cannot be immediately freed or reused once the delete restarts, since it was made reachable from parent.update. Instead, it must be freed using a safe memory reclamation algorithm for nonblocking data structures.

  6. 6.

    If a helper fails the CAS in step (d) because parent is “locked” by a different operation, the helper also tries to “unlock” gparent using CAS. Only the first such CAS can succeed, and only if no helper performed a successful CAS in step (d).

  7. 7.

    Technically, if k is subsequently deleted, or moved again, then it cannot be found by looking at pred; to handle this possibility, the algorithm has a mechanism to determine whether pred has changed since the search visited it, in which case the search will restart.

  8. 8.

    Unfortunately, fully nonblocking automatic garbage collection remains an open problem.

  9. 9.

    In the standard formulation, k must be statically known. Some HP implementations allow it to be dynamically determined.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Michael L. Scott .

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Scott, M.L., Brown, T. (2024). Nonblocking Algorithms. In: Shared-Memory Synchronization. Synthesis Lectures on Computer Architecture. Springer, Cham. https://doi.org/10.1007/978-3-031-38684-8_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-38684-8_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-38683-1

  • Online ISBN: 978-3-031-38684-8

  • eBook Packages: Synthesis Collection of Technology (R0)

Publish with us

Policies and ethics

Navigation