| ▲ | eqvinox an hour ago | ||||||||||||||||||||||||||||||||||||||||
I think you missed the point; seqlock based approaches will lock dead if you suspend/abort a thread in the wrong place. Other lock-free approaches don't have this issue. This isn't about a thread writing garbage, it's about guarantees applicable within the constraints. | |||||||||||||||||||||||||||||||||||||||||
| ▲ | adrian_b an hour ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||
No, you missed my point. I agree that there is the risk for a writer to be halted in the middle of its critical section, which would stop all the other writers and readers. My point is that there exists no solution that is risk free, because if a writer enters an infinite loop while writing the shared data, that will stop progress in any other algorithm, regardless if it is claimed to be wait-free. There exists no method to stop such a writer, except an external intervention from the operating system, which would have to use an IPI (inter-processor interrupt) to halt that CPU core and then kill the offending thread. In my opinion a great number of lock-free or wait-free algorithms, all of which are proposed based on the fear of what happens if a writer is halted in a critical section, are completely impractical, because their overhead is many times higher in comparison with using a lock for writers and using the method from TFA for readers. With those algorithms, a lot of CPU time is wasted continuously to guard against an event that should never happen in bug-free operating systems and applications. It is much more efficient to try to detect the lack of progress and do something about that only in the unlikely case when this happens. | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||