您的位置:首页 > 理论基础 > 数据结构算法

无锁数据结构(五)

2007-12-30 03:39 246 查看
无锁数据结构(五)


Andrei Alexandrescu
December 16, 2007
译者:张桂权
12/25/2007

(初稿阶段,没有得到许可不得引用,否则后果自负)

7 结束语
无锁数据结构是非常有希望的。它们通过线程消亡、优先级反演和信号安全等展示了很多优秀的特性。它们从来不会死锁或活锁。在测试中,最近的无锁数据结构通过一个很大的容限超过了它们加锁的副本。
然而,无锁编程是一种技巧,尤其与内存分解有关。一个有垃圾收集的环境是必要的,因为它拥有一些手段来终止和审查所有的线程,但是如果你想要确定性的解构,你需要硬件或内存分配器的特殊支持。泛型编程(Generic<Programming>)的下一部分将了解在执行确定性解构时支持无锁的WRRMMap的优化方法。如果这一个部分中基于垃圾收集和WRRMBNTM的map不能满足于你,那么这儿有一个省钱的方法:不要去看电影,《Alien vs. Predator》,除非你喜欢“这么坏,太滑稽了(so bad it’s funny)”的电影。

8 致谢
特别感谢Krzysztof Machelski,他审核了代码的实现,并提示其中的两个bug。

参考文献
[1] Andrei Alexandrescu. Modern C++ Design.Addison-Wesley Longman, 2001.
[2] Andrei Alexandrescu. GenerichProgrammingi:yasli::vector is on the move. C++ Users Journal,June 2004.
[3] D.R. Butenhof. Programming with POSIX Threads. Addison-Wesley, Reading, Massachusetts,USA, 1997.
[4] David L. Detlefs, Paul A. Martin, Mark Moir,and Guy L. Steele, Jr. Lock-free reference counting.In Proceedings of the twentieth annual ACM symposium on Principles of distributed computing,pages 190–199. ACM Press, 2001. ISBN 1-58113-383-9.
[5] Erich Gamma, Richard Helm, Ralph E. Johnson,and John Vlissides. Design Patterns. Addison-Wesley, Reading, MA, 1995.
[6] Scott Meyers and Andrei Alexandrescu. The Perils of Double-Checked Locking. Dr. Dobb’s Journal,July 2004.
[7] Maged M. Michael. Scalable lock-free dynamic memory allocation.
In Proceedings of the ACM SIGPLAN 2004 conference on Programming language design and implementation,pages 35–46.ACM Press, 2004. ISBN 1-58113-807-5.

---------------源文档------------------
Lock-Free Data Structures
Andrei Alexandrescu
December 17, 2007 http://erdani.org/publications/cuj-2004-10.pdf 最后一次访问时间:2007年12月30日
----------------------------------------

译稿下载: http://download.csdn.net/source/346893
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: