开发者

In the linux kernel, where is the first process initialized?

I'm looking for the code in the linux kernel (2.4.x) that initializes t开发者_如何学Che first process, pid=0.

Many searches provided many clues, but I still cannot find it.

Any pointers, anyone?


The initial task struct is set up by the macro INIT_TASK(), defined in include/linux/init_task.h. All other task structs are created by do_fork.


start_kernel()

check out rest_init() at the end

// idle process, pid = 0
cpu_idle();     // never return


The first process that the kernel initializes is the swapper process or the idle thread. This thread runs forever. When no other process is active in the system, then this thread [which is cpu_idle() function found in arch/arm/kernel/process.c for the ARM architecture] calls the architecture dependent pm_idle function, which power collapses the CPU until a timer interrupt or some other interrupt wakes it up.

The swapper process [pid=0] is initialized in arch/arm/kernel/init_task.c by the macro INIT_TASK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜