Skip to content

Comment on Concurrent Programming, with Examplesparent

Comments

The main disadvantage of lock-free techniques is that you have to write code without any critical sections, that is, you have to properly manage arbitrary interleaving of actions. It's hard enough to manage staleness/inconsistency of data at high (business logic) level, never mind the low level where the code is not even executed in the written order.

Also lock free usually means atomics which means memory fences. Those can be slow. It's another tool you should have available though.

Memory fences and atomics are a part of lock-based code as well. They're just hidden by the locking and notification primitives.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.