Skip to content

Instantly share code, notes, and snippets.

@wolfram77
Last active September 26, 2021 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfram77/0dc7ef397381b0d0bb33bd38331cb572 to your computer and use it in GitHub Desktop.
Save wolfram77/0dc7ef397381b0d0bb33bd38331cb572 to your computer and use it in GitHub Desktop.
Nonblocking k-compare-single-swap : NOTES

Highlighted notes on:
Nonblocking k-compare-single-swap.
While studying the course Concurrent Data Structures by Prof. Govindarajulu Regeti.

In computer science, compare-and-swap (CAS) is an atomic instruction used in multithreading to achieve synchronization. It compares the contents of a memory location with a given value and, only if they are the same, modifies the contents of that memory location to a new given value. This is done as a single atomic operation. The atomicity guarantees that the new value is calculated based on up-to-date information; if the value had been updated by another thread in the meantime, the write would fail. The result of the operation must indicate whether it performed the substitution; this can be done either with a simple boolean response (this variant is often called compare-and-set), or by returning the value read from the memory location (not the value written to it).

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment