Compare-and-swap | Wikipedia audio article

Описание к видео Compare-and-swap | Wikipedia audio article

This is an audio version of the Wikipedia Article:
https://en.wikipedia.org/wiki/Compare...


00:01:18 1 Overview
00:03:14 1.1 Example application: atomic adder
00:04:28 1.2 ABA problem
00:07:04 1.3 Costs and benefits
00:08:48 2 Implementations
00:10:46 2.1 Implementation in C
00:12:04 3 Extensions
00:14:38 4 See also



Listening is a more natural way of learning, when compared to reading. Written language only began at around 3200 BC, but spoken language has existed long ago.

Learning by listening is a great way to:
increases imagination and understanding
improves your listening skills
improves your own spoken accent
learn while on the move
reduce eye strain

Now learn the vast amount of general knowledge available on Wikipedia through audio (audio article). You could even learn subconsciously by playing the audio while you are sleeping! If you are planning to listen a lot, you could try using a bone conduction headphone, or a standard speaker instead of an earphone.

Listen on Google Assistant through Extra Audio:
https://assistant.google.com/services...
Other Wikipedia audio articles at:
https://www.youtube.com/results?searc...
Upload your own Wikipedia articles through:
https://github.com/nodef/wikipedia-tts
Speaking Rate: 0.9378089485700016
Voice name: en-AU-Wavenet-A


"I cannot teach anybody anything, I can only make them think."
Socrates


SUMMARY
=======
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).
Algorithms built around CAS typically read some key memory location and remember the old value. Based on that old value, they compute some new value. Then they try to swap in the new value using CAS, where the comparison checks for the location still being equal to the old value. If CAS indicates that the attempt has failed, it has to be repeated from the beginning: the location is re-read, a new value is re-computed and the CAS is tried again.

Комментарии

Информация по комментариям в разработке