作者andytzeng (Ya-Shiuan)
看板LinuxDev
标题Re: [问题] multicore 和 multithreading 的关系
时间Thu Mar 22 12:54:57 2007
※ 引述《dataiann (DaTaiAnn)》之铭言:
: 最近听到一些新的 multicore CPU 对於程式的影响
: 大概的意思是说, 每个 core 的时脉比以前的 single core 低
: 但是, 藉由多个 core 来提升 performance
: 所以, 现在一些同事在测量 data/instruction cache 的 hit rate
: 同时, 有提到将来写程式和 multithreading 的关系之类的
: 我本身不是CS相关科系, 所以不是很了解 multicore 和 multithread 的关系
: 对於 thread 也不是很清楚
据我了解,Linux 和 Windows 对於 Thread 的 implement 方式并不相同,在
Linux 里面 Thread 是以所谓的 LWP (lightweight process) 方式存在 kernel
中,因此从 schedule 的角度来看,都是以 process 为单位做 scheduling
而支援 multi-core 的 scheduler 就会有能力将 N 个 process 同时 scheduling
到 N 个 core 上,端看有多少个 core,这样就可以了解为什麽要实作
multithreading 的程式..
至於效能的提升,就不是可以这麽简单就探讨完,这牵涉到众多因素,我的能力
也不足以探讨这个深奥的问题..
在 Understanding the Linux Kernel 这本书第三、七章也有提到 LWP 与
scheduler 的关系,有兴趣可以参考看看..
至於 windows...MS 自己也出了本 Windows internals 里面也有介绍
这部分我就不了解了..
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.135.188.188
1F:推 final01:linux是2..6才有LWP的吗 04/03 20:05
2F:推 bamboo82:windows 也有lightweight thread 01/22 01:36