"Scalable Multithreaded Programming with Thread Pools" 阅读笔记
来源:互联网 发布:孤陋寡闻的网络 编辑:程序博客网 时间:2024/06/05 15:17
(MSDN Magzine 上的文章)
"There are many different ways to distribute your work across multiple cores. One of the easiest and most robust is called task-based programming."
"To achieve this state of multicore bliss, you’ll have to reexamine some of your preconceptions of how to attack a programming problem and rethink them in terms of task-based programming."
From Threads to Tasks
"
There are a few guidelines to keep in mind when converting a large single-threaded job into multithreaded tasks:
- The large job can be arbitrarily divided into 1 to n tasks.
- The tasks should be able to run in any order.
- The tasks should be independent of each other.
- The tasks must have associated context data.
Using the Thread Pool
"Threads require a lot of bookkeeping by the OS, so it’s not a good idea to wantonly create and destroy them. There are not-insignificant costs associated with creating and destroying a thread, so if you do this constantly, it’s easy to lose any advantage you gain by multithreading."
"The advantage of using a thread pool instead of creating your own threads is that the OS will take care of scheduling tasks for you—your job will be to keep feeding tasks into the thread pool so that the OS will be able to keep all of the hardware threads busy."
本来期待这篇文章能介绍 Thread Pool 的机制及调用建议, 结果往后面一看, 发现转到以快速排序为例子讲如何切分 task 去了, 没什么意思.
不过文章前面介绍基本原则的地方多少还是值得一看.
- "Scalable Multithreaded Programming with Thread Pools" 阅读笔记
- Multi-Programming-5 Thread Pools
- Thread Pools
- Thread Pools
- “Multithreaded Job Queue”源码阅读笔记
- [阅读笔记]Modern C++ Programming with Test-Driven Develpment chp2
- [阅读笔记]Modern C++ Programming with Test-Driven Develpment chp3
- Multithreaded Programming Using C#
- 线程池 Thread Pools
- Thread Pools 线程池
- [论文阅读]词汇树 Scalable Recognition with a Vocabulary Tree
- Multithreaded Tests with JUnit
- tinyOS programming 阅读笔记
- Posix multi-thread programming 笔记
- JCIP-8-Applying Thread Pools
- 论文笔记《Superparsing: Scalable Nonparametric Image Parsing with Superpixels》
- Multithreaded unit testing with ConTest
- Multithreaded Magic with ØMQ
- [Centos5.4]国内巨快的Centos yum源
- 动态添加删除Spinner
- ORACLE9卸载
- WCF 入门文章推荐
- PreferenceActivity使用
- "Scalable Multithreaded Programming with Thread Pools" 阅读笔记
- 善用"Assume No Aliasing"编译选项
- 一个滑动展示的小代码
- 2 - Perl - 比较运算符
- Oracle数据库字符集问题解决方案大全
- [Centos5.4]字体
- oracle主键实现自增
- .NET CF C# 位图的任意角度旋转
- GT开发最基本安装