What context does the scheduler code run in?

前端 未结 3 456
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 22:11

There are two cases where the scheduler code schedule() is invoked-

  1. When a process voluntarily calls schedule()

  2. Timer

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-31 22:43

    schedule() always runs in process context. In the second case, when it is initiated by a timer interrupt, it is in the return path back from the kernel to the interrupted process where schedule() is called.

提交回复
热议问题