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

前端 未结 9 1236
面向向阳花
面向向阳花 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:40

    Everytime you have a task waiting for an I/O operation it does make a sense to enclose it in a thread and fire it up. There's a great probability that your thread will be suspended while waiting for the I/O operation to finish. When it gets waken up the result will be waiting for it.

提交回复
热议问题