Does it make sense to spawn more than one thread per processor?

前端 未结 9 1248
面向向阳花
面向向阳花 2020-12-10 16:15

From a logical point of view an application may need dozens or hundreds of threads, some of which will we sleeping most of the time, but a very few will be always running co

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-10 16:42

    Other have talked about situations in which it almost certainly does make sense (when you are doing any kind of slow IO).

    It might not be a good idea if:

    • your threads are doing CPU bound work

    and

    • the threads each want to use a lot (i.e. significant compared to the cache size) of memory that does not overlap

    In this case there is the possibility of causing unnecessary cache misses.

提交回复
热议问题