News for hackers. Stuff that matters.
Re:A lock-free ring-buffer with contiguous reservations (2019) by DannyBee on Friday March 01, 2024 @12:09AM (#39558720)
It's a reasonable question, because lock-free is a confusing term.

Lock-free here does not mean "without any form of synchronization primitive". That is impossible. Some synchronization must occur.

Instead, it is a term of art that means:

1. Thread failure can't cause other threads to get blocked. 2. Forward progress in the algorithm is guaranteed.

Basically: threads can't block each other and death of threads does not screw things up.

https://en.wikipedia.org/wiki/Non-blocking_algorithm

CPU atomics often work by blocking (they have to) but they are non-interruptible instructions and there is a fixed maximum execution time.

(So you can still guarantee forward progress if you use them).

There are no comments on this comment yet.