由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 用多线程怎么比单线程还慢呢?
相关主题
Perl多线程的问题【求助】Fortran多线程执行效率问题
多线程编程前景如何?为什么VC6调试多线程Debug菜单下的Threads是灰的?
c++下如何实现多线程?多线程有什么优化的方法?
写thread safe程序现在也是程序员必须要掌握的了吧多线程计时不准std::thread尝鲜 问题
如果一个core,多线程还有必要吗?推荐一下C++多线程的书吧
多线程 编程,process 和 thread 的一些问题。C++多线程和硬件的关系
多线程的thread safety checking tool?问个白痴问题
p-thread profiling有人熟悉Python里的threading吗
相关话题的讨论汇总
话题: 多线程话题: 单线程话题: threads话题: thread话题: multi
进入Programming版参与讨论
1 (共1页)
w*********s
发帖数: 277
1
用perl来读一堆文件
1.单线程顺序一个一个的读文件
2.用多线程读多个文件,每个线程读一个文件
光读,没做任何操作。
用time命令看运行时间
结果发现2比1慢好多,咋回事呢?
谢谢!
b******n
发帖数: 592
2
1.platform is not hypertheaded and not multi-core
2.if you check usertime, the multi-thread will actually use more cpu time
3.not familiar with perl multi-thread..are they real threads..
4.disk i/o could limit your performance as well. imagine harddisk has to
move forward backward to fulfill the demands of all threads
5.depends on how you implement, too many conditions on threads will result
in inefficient code

【在 w*********s 的大作中提到】
: 用perl来读一堆文件
: 1.单线程顺序一个一个的读文件
: 2.用多线程读多个文件,每个线程读一个文件
: 光读,没做任何操作。
: 用time命令看运行时间
: 结果发现2比1慢好多,咋回事呢?
: 谢谢!

k*******d
发帖数: 1340
3
我觉得4的可能性比较大,如果只是单个硬盘,跳来跳去寻道的时间多

time
result

【在 b******n 的大作中提到】
: 1.platform is not hypertheaded and not multi-core
: 2.if you check usertime, the multi-thread will actually use more cpu time
: 3.not familiar with perl multi-thread..are they real threads..
: 4.disk i/o could limit your performance as well. imagine harddisk has to
: move forward backward to fulfill the demands of all threads
: 5.depends on how you implement, too many conditions on threads will result
: in inefficient code

f*******y
发帖数: 988
4
全是外部I/O搞啥多线程

【在 w*********s 的大作中提到】
: 用perl来读一堆文件
: 1.单线程顺序一个一个的读文件
: 2.用多线程读多个文件,每个线程读一个文件
: 光读,没做任何操作。
: 用time命令看运行时间
: 结果发现2比1慢好多,咋回事呢?
: 谢谢!

t****u
发帖数: 8614
5
十有八九是程序没写对,虽然两个thread,但仍然是serialized read operation。
加上thread context switch,所以结果反而慢。

【在 w*********s 的大作中提到】
: 用perl来读一堆文件
: 1.单线程顺序一个一个的读文件
: 2.用多线程读多个文件,每个线程读一个文件
: 光读,没做任何操作。
: 用time命令看运行时间
: 结果发现2比1慢好多,咋回事呢?
: 谢谢!

x**********g
发帖数: 357
6


【在 b******n 的大作中提到】
: 1.platform is not hypertheaded and not multi-core
: 2.if you check usertime, the multi-thread will actually use more cpu time
: 3.not familiar with perl multi-thread..are they real threads..
: 4.disk i/o could limit your performance as well. imagine harddisk has to
: move forward backward to fulfill the demands of all threads
: 5.depends on how you implement, too many conditions on threads will result
: in inefficient code

1 (共1页)
进入Programming版参与讨论
相关主题
有人熟悉Python里的threading吗如果一个core,多线程还有必要吗?
c++多线程的工作面试一般会问哪些问题?多线程 编程,process 和 thread 的一些问题。
如果面试一个候选人,算法答的很好,java多线程没什么经验 回答的不上路 你会招么多线程的thread safety checking tool?
真正的multi-threading是5个thread要5个cpu?那apache是真正的mp-thread profiling
Perl多线程的问题【求助】Fortran多线程执行效率问题
多线程编程前景如何?为什么VC6调试多线程Debug菜单下的Threads是灰的?
c++下如何实现多线程?多线程有什么优化的方法?
写thread safe程序现在也是程序员必须要掌握的了吧多线程计时不准std::thread尝鲜 问题
相关话题的讨论汇总
话题: 多线程话题: 单线程话题: threads话题: thread话题: multi