should I “bind” “spinning” thread to the certain core?

后端 未结 5 1407
难免孤独
难免孤独 2021-02-03 11:32

My application contains several latency-critical threads that \"spin\", i.e. never blocks. Such thread expected to take 100% of one CPU core. However it seems modern operation s

5条回答
  •  一向
    一向 (楼主)
    2021-02-03 11:58

    This is simply foolish. All it does is reduce the scheduler's flexibility. Whereas before it could run it on whatever core it thought was best, now it can't. Unless the scheduler was written by idiots, it would only move the thread to a different core if it had a good reason to do that.

    So you're just saying to the scheduler, "even if you have a really good reason to do this, don't do it anyway". Why would you say that?

提交回复
热议问题