Bookcold

导航

多线程程序设计中的8条简单原则

Rule 1: Identify Truly Independent Computations

Rule 2: Implement Concurrency at the Highest Level Possible

Rule 3: Plan Early for Scalability to Take Advantage of Increasing Numbers of Cores

Rule 4: Make Use of Thread-Safe Libraries Wherever Possible

Rule 5: Use the Right Threading Model

Rule 6: Never Assume a Particular Order of Execution

Rule 7: Use Thread-Local Storage Whenever Possible or Associate Locks to Specific Data

Rule 8: Dare to Change the Algorithm for a Better Chance of Concurrency

规则1:找出真正独立的运算

规则2:在尽可能高的层次上实现并发

规则3:尽早考虑通过增加处理器核的数量来获得可伸缩性

规则4:尽可能使用线程安全的库

规则5:使用正确的多线程模型

规则6:永远不要假设程序会按照某种特定的顺序执行

规则7:尽可能使用线程局部存储或者与特定数据相关的锁

规则8:要敢于对代码进行修改以获得更好的并发性

内容来自于《并发的艺术》

Note: Cross posted from Bookcold's Blog.
Permalink

posted on 2010-10-04 23:12  bookcold  阅读(294)  评论(0)    收藏  举报