Jump to content

Non-blocking linked list

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Miacobv (talk | contribs) at 17:47, 30 November 2014 (Solutions). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A non-blocking linked list is an example of non-blocking data structures designed to implement a linked list in shared memory using synchronization primitives:

Operations on lock-free linked lists

Insertion

Basic idea

  • search for the right spot in the list
  • insert using [Compare-and-swap]

Deletion

Basic idea

  • search for the right spot in the list
  • insert using [Compare-and-swap]

Problem

  • a process deleting node B requires an atomic action on the node's predecessor
  • concurrently another process tries to insert a node C after node B (B.next=C)
  • node B is deleted from the list but C is gone along with it

Solutions

  • place a 'mark'

[1]

in the next pointer of the soon-to-be deleted node
  • fail when we try to CAS the 'mark'
  • when detected go back to start of the list and restart

See also

Further reading

  • A Pragmatic Implementation of Non-blocking Linked-Lists, Timothy L Harris

References

  1. ^ Harris, T. (2001), A Pragmatic Implementation of Non-Blocking Linked Lists, DISC '01 Proceedings of the 15th International Conference on Distributed Computing, Springer-Verlag London, UK, pp. 300–314{{citation}}: CS1 maint: location missing publisher (link)