TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

An Introduction to Lock-Free Programming (2012)

83 点作者 bowyakka超过 11 年前

7 条评论

unwind超过 11 年前
I ran into this problem last year, that ordinary mutexes were not working out due to various reasons.<p>Since I do embedded programming, I looked through the ARM manuals and documentation, to see what they have on offer.<p>I ran into the lovely LDREX and STREX instructions, which are just awesome.<p>It was pretty trivial to rewrite e.g. a custom allocator that used to grab a mutex, poke its internal freelists, and release the mutex so that it instead does the poking with <i>LDREX&#x2F;STREX</i>, thus obtaining thread-safety while doing the actual work it wanted to do. Lock-free programming can be beautiful like that.<p>See <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204f/Cihbghef.html" rel="nofollow">http:&#x2F;&#x2F;infocenter.arm.com&#x2F;help&#x2F;index.jsp?topic=&#x2F;com.arm.doc....</a> for the instruction reference on LDREX&#x2F;STREX.
Patient0超过 11 年前
Oh man, now that lock free programming is such a hot topic I am dreading the code about to be written by people &quot;teaching themselves&quot; about it!<p>&quot;This algorithm is much faster now that I&#x27;ve used some lock free programming techniques I just read about!!!&quot;<p>Code that works correctly on x86 but fails intermittently on another processor. It&#x27;s like a nightmare unfolding...
评论 #7253682 未加载
评论 #7256434 未加载
fit2rule超过 11 年前
I always found this paper to be quite a good introduction to lock-free techniques:<p><a href="http://www.grame.fr/ressources/publications/LockFree.pdf" rel="nofollow">http:&#x2F;&#x2F;www.grame.fr&#x2F;ressources&#x2F;publications&#x2F;LockFree.pdf</a><p>In the music world, such issues have been solved repeatedly over the years - seems like a little cross-polination would be a good thing ..
taspeotis超过 11 年前
Raymond Chen has a pretty practical guide to lock-free algorithms on his blog.<p><a href="http://social.msdn.microsoft.com/Search/en-US?query=Lock-free%20algorithms&amp;beta=0&amp;rn=The+Old+New+Thing&amp;rq=site:blogs.msdn.com/b/oldnewthing/&amp;ac=5" rel="nofollow">http:&#x2F;&#x2F;social.msdn.microsoft.com&#x2F;Search&#x2F;en-US?query=Lock-fre...</a>
pron超过 11 年前
This is perhaps the place to mention that Java 8 has memory-fence intrinsics (loadFence, storeFence, fullFence in Unsafe)
dschiptsov超过 11 年前
Does side-effect-free programming with persistent data-structures on share-nothing, actor-based architecture, in other words Erlang is qualified to be lock-free?<p>It seems that Haskell also doesn&#x27;t exist.)
评论 #7252612 未加载
评论 #7251924 未加载
评论 #7251898 未加载
评论 #7252231 未加载
CmonDev超过 11 年前
Does unintended infinite message loop count as a dead-lock?
评论 #7254297 未加载