Linux kernel: What process does schedule() run in?

后端 未结 4 561
没有蜡笔的小新
没有蜡笔的小新 2021-02-04 22:24

When you call a system call such as fork in process X, the kernel is said to be executing in process context. So, fork can be said to be running in pro

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-04 22:50

    schedule() is always running in process context. The special part about it is that it can change which process context is current - but it does always have a process context. Prior to the call to context_switch() it runs in the context of the process to be swapped out, and after it runs in the process swapped in.

    The Linux kernel does not have a dedicated "swapper" task (there is an idle task, which is always runnable in case nothing else is eligible to run).

提交回复
热议问题