Multiple threads and performance on a single CPU

后端 未结 6 2008
清酒与你
清酒与你 2020-12-15 07:17

Is here any performance benefit to using multiple threads on a computer with a single CPU that does not having hyperthreading?

6条回答
  •  不知归路
    2020-12-15 07:41

    Yes, there is a benefit of using multiple threads (or processes) on a single CPU - if one thread is busy waiting for something, others can continue doing useful work.

    However this can be offset by the overhead of task switching. You'll have to benchmark and/or profile your application on production grade hardware to find out.

提交回复
热议问题