Multithreading: What is the point of more threads than cores?

后端 未结 17 929
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 16:24

I thought the point of a multi-core computer is that it could run multiple threads simultaneously. In that case, if you have a quad-core machine, what\'s the point of having

17条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 16:52

    I know this is a super old question with plenty of good answers, but I am here to point out something that is important in current environment:

    If you want to design an application for multi-threading, you should not be designing for a specific hardware setting. CPU technology has been advancing quite rapidly for years, and core counts are increasing steadily. If you deliberately design your application such that it uses only 4 threads, then you are potentially restricting yourself in a octa-core system (for example). Now, even 20-core systems are commercially available, so such a design is definitely doing more harm than good.

提交回复
热议问题