logoalt Hacker News

adrian_btoday at 2:55 PM3 repliesview on HN

That is always possible, even in any algorithm that claims to be wait-free, if some writer just keeps writing the shared data.

All the claims about something being lock-free and/or wait-free depend on a rational behavior of the writers.

If any writer acts crazy, progress becomes impossible regardless of what all others do, unless someone kills the rogue thread or process.

In practice, the algorithm from TFA is much more likely to guarantee progress than any of the algorithms that are theoretically proven to guarantee progress, because it has an extremely small overhead, while the alternatives are much more complex and they waste a lot of time.

Moreover, most wait-free algorithms guarantee progress only for the whole system, in the sense that one random thread will progress, but they do not guarantee anything for a given thread, which may be blocked forever or stuck in an infinite loop, if unlucky.


Replies

danbructoday at 3:02 PM

Not true, a wait-free algorithm guarantees that a read will complete in a bounded amount of time. And it guarantees that all threads make progress, it is lock-free that only guarantees progress for one thread.

If the value changes frequently, it will get outdated quickly, but that has nothing to do with the synchronization mechanism used. And even if writes happen rarely, there is always a chance that the value you read will be outdated a nanosecond later.

show 1 reply
eqvinoxtoday at 3:03 PM

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.

show 1 reply