多线程的程序在多核CPU与单核CPU运行效率有何不同?

jdlsfl 2008-04-29 05:41:01
多线程的程序在多核CPU与单核CPU运行效率有何不同?
...全文
359 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jdlsfl 2008-05-08
  • 打赏
  • 举报
回复
谢谢
蒋晟 2008-04-30
  • 打赏
  • 举报
回复
Depends on how the OS schedule threads to CPUs, and how applications set their threads' processor affinity

In windows, the operating system does the allocation for you based on cpu usage. You can set the affinity but, it will not determine which processor you run on. On the XBox 360, the affinity is needed otherwise the 360 will not allocate your thread to a seperate processor at all.

In Mac, threads with default affinity policy will be scheduled freely on any processor. These threads will be preferentially migrated to run on an idle processor. Threads with affinity tags will tend to remain in place.

In linux, you can froce the thread to migrate on the other cpu, by calling *_setaffinity() with different mask.

567

社区成员

发帖
与我相关
我的任务
社区描述
英特尔® 边缘计算,聚焦于边缘计算、AI、IoT等领域,为开发者提供丰富的开发资源、创新技术、解决方案与行业活动。
社区管理员
  • 英特尔技术社区
  • shere_lin
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧