G***G 发帖数: 16778 | 1 suppose we have one processor with one core.
suppose, when traditionaly we download a file from internet with one thread,
it would take 10 minutes.
if we use multi-threads software to download it (suppose 10 threads),
do you feel it would decrease the downloading time amazingly,
or they cost just the same time (both are 10 minutes because your computer
are one cpu with one core? |
s*******o 发帖数: 300 | 2 Looks like you get tangled by threads recently, no fishing:)
No. It won't be faster. The server and the internet path speed(delay)
decides how fast you can download A file. |
G***G 发帖数: 16778 | 3 I began to become interested in multi-threading programming,
parallel programming, real-time programming,
supercomputer programming.
【在 s*******o 的大作中提到】 : Looks like you get tangled by threads recently, no fishing:) : No. It won't be faster. The server and the internet path speed(delay) : decides how fast you can download A file.
|
t*******y 发帖数: 10477 | 4 Dude, this has nothing to do with how many cores does a CPU has.
Multi threading will definitely decrease the time of downloading. Try
flashget and you
will see the difference.
The magic is, CPU is much faster than IO. Your PC may have only one CPU with
one core,
but think about how many things it is running simultaneously: windows, mouse
,
keyboard, service, networking, disk management...the CPU switch between
these tasks
thousands of times each second.
Thus, when you use multiple threads to download a file, most of the time, the
CPU is
NOT downloading the file piece, but waiting for the bits to come in; and
while
waiting, it has been switched to other tasks. More cores will help to make
things even
faster, but not required.
thread,
【在 G***G 的大作中提到】 : suppose we have one processor with one core. : suppose, when traditionaly we download a file from internet with one thread, : it would take 10 minutes. : if we use multi-threads software to download it (suppose 10 threads), : do you feel it would decrease the downloading time amazingly, : or they cost just the same time (both are 10 minutes because your computer : are one cpu with one core?
|
G***G 发帖数: 16778 | 5 you thought in the same way as I.
But an American professor bet me with 6 pack of beers on this,
multi-threading won't increase any efficency for one core one processor
computer.
He works for high performance computer center for nearly 20 years.
And many professors buy his theory.
with
mouse
【在 t*******y 的大作中提到】 : Dude, this has nothing to do with how many cores does a CPU has. : Multi threading will definitely decrease the time of downloading. Try : flashget and you : will see the difference. : The magic is, CPU is much faster than IO. Your PC may have only one CPU with : one core, : but think about how many things it is running simultaneously: windows, mouse : , : keyboard, service, networking, disk management...the CPU switch between : these tasks
|
t*******y 发帖数: 10477 | 6 I bet you that's probably why we are yet to see any real high performance
computer appear...
【在 G***G 的大作中提到】 : you thought in the same way as I. : But an American professor bet me with 6 pack of beers on this, : multi-threading won't increase any efficency for one core one processor : computer. : He works for high performance computer center for nearly 20 years. : And many professors buy his theory. : : with : mouse
|
r********n 发帖数: 6979 | 7 flashget在单核时代就有了
确实大大增加了下载速度
【在 G***G 的大作中提到】 : you thought in the same way as I. : But an American professor bet me with 6 pack of beers on this, : multi-threading won't increase any efficency for one core one processor : computer. : He works for high performance computer center for nearly 20 years. : And many professors buy his theory. : : with : mouse
|
k****e 发帖数: 297 | 8 It partially depends on the server where the file stored and your connection
bandwidth.
In the case the server has limit on download speed per thread but allow
multiple request, and your bandwidth happened to be more than that limit,
the multi-threads
could do decrease the downloading duration.
thread,
【在 G***G 的大作中提到】 : suppose we have one processor with one core. : suppose, when traditionaly we download a file from internet with one thread, : it would take 10 minutes. : if we use multi-threads software to download it (suppose 10 threads), : do you feel it would decrease the downloading time amazingly, : or they cost just the same time (both are 10 minutes because your computer : are one cpu with one core?
|
k**0 发帖数: 19737 | 9 single core PC can run multi-threading programs as well. |
s*******o 发帖数: 300 | 10 You are right. I did not realize they can split download into several
pieces. Guess I am too old.....
Still, you don't need a high end PC as the bottleneck is on bandwidth/IO.
Server can also limit bandwidth usage for each request.
【在 r********n 的大作中提到】 : flashget在单核时代就有了 : 确实大大增加了下载速度
|
|
|
f*******e 发帖数: 8974 | 11 我觉得你举的多线程下载和处理器多线程是两码事。
据我所知windows不是并发多线程系统,所以理论上不能同时处理两个任务,只是在处
理器内部分配优先级,先到先作。所以我们看到的速度提高应该不是并行的结果,而是
指令处理顺序优化的结果。
现在的gpgpu编程应该是并行的,所以特定的程序在gpu上运行比在通用处理器上快很多
倍。
所以你的教授说的应该是对的,multi-core并行处理才是真正的并行,现在不也是朝这
个方向发展吗?
BTW,我不搞这个哈,不负责
BTW2,多线程下载效率绝对成倍增加,前提是服务器端的带宽和你自己的带宽都没用完
。如果你还用拨号,和现在的宽带比多线程没一点用。
【在 G***G 的大作中提到】 : you thought in the same way as I. : But an American professor bet me with 6 pack of beers on this, : multi-threading won't increase any efficency for one core one processor : computer. : He works for high performance computer center for nearly 20 years. : And many professors buy his theory. : : with : mouse
|
G***G 发帖数: 16778 | 12 其实考虑下面例子。
总和每年的工资,从1990年到2010年的。
假设windows计算机是单cpu,单core
如果只有一个thread, (我还不知道一个概念,就是什么是进程,什么是线程)
那么需要时间n
如果开thread,那么时间会小于n,比如2/3吗? |
f*******e 发帖数: 8974 | 13 我不懂啊,哈哈,所以不要听我瞎掰,平时喜欢瞎看而已,只知道名词,很多时候不知
道说的是啥,嘿嘿
编程要针对多线程优化的话是不是得看看intel的白皮书之类,或者找个intel的编译器
自己试试
我只知道以前自己攒机用super pi做测试,这个程序是单线程的,只能利用一个核心,
所以在低频4核机器上表现不如高频双核的机器。现在有多线程的mod,实际上我看也不
是多线程,就是允许多个super pi进程同时运行,这样通过系统把任务分配给多个cpu
核心,就可以利用多核的好处,也更能表现系统真实性能。
另外,我觉得你的那个例子答案是 1
这根本不是多线程的问题啊,尤其是单核cpu,我的理解是windows是抢先式的多任务,如果你两个字程序同时运行,任务分配会占用资源,从而时间延长。不过你这个程序比较短,任务轻,也许看不出来,如果你循环运行1万次,累计时间肯定能看出来的。
理论上,如果是双核,而且系统可以完美分配任务到每个核心,那么答案就是x=y=1/2 n
如果是单核多线程,从看到的测试看应该是 x+y < n,但是效率肯定不会加倍,所以比双核理想情况要慢。
【在 G***G 的大作中提到】 : 其实考虑下面例子。 : 总和每年的工资,从1990年到2010年的。 : 假设windows计算机是单cpu,单core : 如果只有一个thread, (我还不知道一个概念,就是什么是进程,什么是线程) : 那么需要时间n : 如果开thread,那么时间会小于n,比如2/3吗?
|
t*******y 发帖数: 10477 | 14 the answer is:
4) x=z
【在 G***G 的大作中提到】 : 其实考虑下面例子。 : 总和每年的工资,从1990年到2010年的。 : 假设windows计算机是单cpu,单core : 如果只有一个thread, (我还不知道一个概念,就是什么是进程,什么是线程) : 那么需要时间n : 如果开thread,那么时间会小于n,比如2/3吗?
|
t*******y 发帖数: 10477 | 15 LZ问的是多进程同步下载会不会快些;他的教授说单Core CPU无法通过多进程提高
Efficiency。这两者基本没有关系。
下载速度跟CPU是否efficient关系不大。cpu再不efficient,它99%的时间还
是在等待network IO。 时下的CPU时钟大致在2GZ左右。即每秒运行400万条指令
(以平均每条指令花费五个clock cycle计算)。
T1 line 是1.5Mb/sec, T3 是44Mb/sec, 最快的t4 是274Mb/sec。
甚至连USB2,也只有480Mb/sec。以每传送一个Byte为一个指令算的话
(实际上每条指令通过Direct memory access (DMA)可以搬运更多
Byte),连USB2都只有CPU速度的1/10。也就是说,你同时连10个USB2
到一单CoreCPU的Computer上,同时从这10个USB2 Drive上“download"
file 到Computer里,看起来这十个Download是在同步进行一样。一个单核
CPU就可以同时handle这么多高速IO。
现在想象一下,将这些个USB2 ports合并成一个低于T1的internet
connection。那个单核CPU will be bored to death waiting
for the bits to come through. That is why, CPU efficiency has
nothing to do with 下载速度。It's efficiency is way beyond
the network speed by many multitudes.
Conclusion:
1. we don't need multi-core cpu to increase download speed.
2. multi-thread download will increase download speed
3. LZ's professor was correct, but his statement has nothing to do with
multi-
threading download speed
【在 f*******e 的大作中提到】 : 我觉得你举的多线程下载和处理器多线程是两码事。 : 据我所知windows不是并发多线程系统,所以理论上不能同时处理两个任务,只是在处 : 理器内部分配优先级,先到先作。所以我们看到的速度提高应该不是并行的结果,而是 : 指令处理顺序优化的结果。 : 现在的gpgpu编程应该是并行的,所以特定的程序在gpu上运行比在通用处理器上快很多 : 倍。 : 所以你的教授说的应该是对的,multi-core并行处理才是真正的并行,现在不也是朝这 : 个方向发展吗? : BTW,我不搞这个哈,不负责 : BTW2,多线程下载效率绝对成倍增加,前提是服务器端的带宽和你自己的带宽都没用完
|
r****p 发帖数: 1949 | 16 码出那么多专用名词,秀才你是头刀子IT?
DMA
【在 t*******y 的大作中提到】 : LZ问的是多进程同步下载会不会快些;他的教授说单Core CPU无法通过多进程提高 : Efficiency。这两者基本没有关系。 : 下载速度跟CPU是否efficient关系不大。cpu再不efficient,它99%的时间还 : 是在等待network IO。 时下的CPU时钟大致在2GZ左右。即每秒运行400万条指令 : (以平均每条指令花费五个clock cycle计算)。 : T1 line 是1.5Mb/sec, T3 是44Mb/sec, 最快的t4 是274Mb/sec。 : 甚至连USB2,也只有480Mb/sec。以每传送一个Byte为一个指令算的话 : (实际上每条指令通过Direct memory access (DMA)可以搬运更多 : Byte),连USB2都只有CPU速度的1/10。也就是说,你同时连10个USB2 : 到一单CoreCPU的Computer上,同时从这10个USB2 Drive上“download"
|
t*******y 发帖数: 10477 | 17 嗯, IT民工。
【在 r****p 的大作中提到】 : 码出那么多专用名词,秀才你是头刀子IT? : : DMA
|
f*******e 发帖数: 8974 | 18 还是你说的专业准确
【在 t*******y 的大作中提到】 : LZ问的是多进程同步下载会不会快些;他的教授说单Core CPU无法通过多进程提高 : Efficiency。这两者基本没有关系。 : 下载速度跟CPU是否efficient关系不大。cpu再不efficient,它99%的时间还 : 是在等待network IO。 时下的CPU时钟大致在2GZ左右。即每秒运行400万条指令 : (以平均每条指令花费五个clock cycle计算)。 : T1 line 是1.5Mb/sec, T3 是44Mb/sec, 最快的t4 是274Mb/sec。 : 甚至连USB2,也只有480Mb/sec。以每传送一个Byte为一个指令算的话 : (实际上每条指令通过Direct memory access (DMA)可以搬运更多 : Byte),连USB2都只有CPU速度的1/10。也就是说,你同时连10个USB2 : 到一单CoreCPU的Computer上,同时从这10个USB2 Drive上“download"
|
t*******y 发帖数: 10477 | 19 I take it as you mean this one:
the answer is:
4) x=z
【在 f*******e 的大作中提到】 : 还是你说的专业准确
|
f*******e 发帖数: 8974 | 20 上你当了
【在 t*******y 的大作中提到】 : I take it as you mean this one: : the answer is: : 4) x=z
|