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

后端 未结 17 928
爱一瞬间的悲伤
爱一瞬间的悲伤 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条回答
  •  -上瘾入骨i
    2020-11-29 16:56

    Threads can help with responsiveness in UI applications. Additionally, you can use threads to get more work out of your cores. For instance, on a single core, you can have one thread doing IO and another doing some computation. If it were single threaded, the core could essentially be idle waiting for the IO to complete. That's a pretty high level example, but threads can definitely be used to pound your cpu a bit harder.

提交回复
热议问题