3 ms·
Don't know if you'll see this, but: Reasoning about lock-free algorithms is hard because there is no mutual exclusion. Locks enforce a critical section; you gu
by scott_s 17y ago
Don't know if you'll see this, but:
Reasoning about lock-free algorithms is hard because there is no mutual exclusion. Locks enforce a critical section; you guarantee that only a single thread will execute in a critical section at any given time. This allows you to change state local to that critical section without worrying about other threads interfering.
Lock-free algorithms have no critical sections. All threads can execute all instructions at all times. This means that when you update shared state, you have to think about the implications of what happens when another thread touches the same state this thread is trying to update. Keeping this level of concurrency in your head at all times is difficult, which means that reasoning about the correctness of an algorithm is difficult.