0

CAS (compare-and-swap) : boolean compareAndSet(int expect, int update)

FAA(fetch-and-add) : int addAndGet(int delta) ???

TAS (test-and-set) : ???

In my understanding:

CAS (compare-and-swap) "synchronizes" (w/o locks, on CPU instructions level) code like this:

if(a==b) {
  a++;  // or a = a + 7;
}

FAA (fetch-and-add) : "synchronizes" (w/o locks, on CPU instructions level) code like this:

x = x + 7;

But I am not sure about what kind of code "test-and-set" related to.

4

1 に答える 1