Atomic Number

Traditional multi-threading approaches use locks to protect shared resources. Synchronization objects like Semaphores provide mechanisms for the programmer to write code that doesn’t modify a shared resource concurrently. The synchronization approaches block other threads when one of the thread is modifying a shared resource. Obviously blocked threads are not doing meaningful work waiting for the lock to be released. Atomic operations on the contrast are based on non-blocking algorithms in which threads waiting for shared resources don’t get postponed. Atomic operations are implemented using hardware primitives like compare and swap (CAS) which are atomic instructions used in multi-threading for synchronization. - SO

C++

Others

Written on November 6, 2019, Last update on September 7, 2020
atomic cpu c++ java