Three application scenarios of lock free in linux 1. spin Lock: Spin lock when the Lock operation is blocked, the thread does not immediately suspend itself, but intermittently Spin (self-loop) operation to let the cpu idling to wait for other threads to release lock www.2cto.com 2. the sequential lock Seqlock allows concurrent read/write operations. The principle is to set a counter. When a write operation is performed, add 1 to the counter atom. Before and after the read operation, compare the counter values. If the values are equal, this indicates that no write operation has been performed. If not, the read operation is performed from the beginning. In scenarios with frequent write operations, frequent read operations may be repeated at www.2cto.com 3. during the RCURead-Copy-Update write operation, Copy the current data structure, apply for a new memory space, modify the Copy, Copy the original array content to the new space, and add new values, after the modification, the writer modifies the pointer of the original data structure to point to the new address, and then calls the memory barrier to make the new value visible to other CPUs. Finally, the author firehoo of the original data structure is released.