惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - Colin_Ye

Mac OS X 中 emacs 24.x+clojure+lein2.x+slime简单编程环境的搭建 JDK中并发状态管理注意事项 JDK中可扩展性和线程安全的注意事项 并发中状态的处理 语言分类,我接触和我想学习的 CPU的内部物理结构介绍【转】自己留着看看 提高编程技巧的十大方法 关于大型机的入门介绍【转】 什么是S-OFF【转】 Android 常识【转·】 关于APK、ROM、SPL、Superuser、ROOT、recovery【转】此文有很多不当之处,但还可以看看 关于Bootloader、Recovery 比较全的Linux目录存放内容 tomcat 内存问题 部分银行核心系统的资料 【转】 一些软件设计的原则【转】——本来想自己总结,结果发现个更全的, 公私钥与加密、签名 SOA复习与总结——企业应用系统集成的总结(1)——基本原则和术语介绍 重读模式与架构(2)——层次划分的依据和角色职责
并发的任务分工
Colin_Ye · 2012-02-21 · via 博客园 - Colin_Ye

Here are the ways to reap the benefits of multicore processors:

• We have to divide the application into multiple tasks that can be run concurrently.

• We should choose at least as many threads as the number of cores, provided the problem is large enough to benefit from those many threads.

• For computationally intensive applications, we should limit the number of threads to the number of cores.

• For IO-intense applications, the time spent blocking influences the number of threads we’d create.

• Estimate the number of threads using the following formula:

Number of threads = Number of Available Cores / (1 - Blocking Coefficient)

where 0 ≤ blocking coefficient < 1.

• We should slice the problem into several parts so there is enough work for cores and they’re utilized well.

• We must avoid shared mutable state and instead use either isolated mutability or shared immutability.

• We should make good use of the modern threading API and thread pools.