Why do we need a swapper task in linux?

后端 未结 4 1501
失恋的感觉
失恋的感觉 2020-12-08 02:11

The idle task (a.k.a. swapper task) is chosen to run when no more runnable tasks in the run queue at the point of task scheduling. But what is the usage for this so special

4条回答
  •  半阙折子戏
    2020-12-08 02:34

    There is actually one idle task per cpu, but it's not held in the main task list, instead it's in the cpu's "struct rq" runqueue struct, as a struct task_struct * .

    This gets activated by the scheduler whenever there is nothing better to do (on that CPU) and executes some architecture-specific code to idle the cpu in a low power state.

提交回复
热议问题