How to ensure the atomicity of the redis command?

We all know that a single redis command can guarantee atomicity, so is this atomicity guaranteed by the operating system"s CAS primitive?

Mar.14,2021

redis is a single-threaded event loop. One operation is executed before the next operation is executed, so there is no need for cas.
see that the source code uses the _ _ sync_bool_compare_and_swap, in gcc, but this has nothing to do with the atomicity that we users want to achieve.

Menu