問題タブ [atomicinteger]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - Which AtomicInteger methods are test-and-set, fetch-and-add and compare-and-swap (in terms of lock-free algorithms)?
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:
FAA (fetch-and-add) : "synchronizes" (w/o locks, on CPU instructions level) code like this:
But I am not sure about what kind of code "test-and-set" related to.