Thinking on the related process of Linux Start_kernel

Source: Internet
Author: User


retired aristocracy process # No. 0
The ancestor of all processes is called process 0 in the system initialization phase by the Start_kernel () function created from scratch by a kernel thread process 0 The last initialization work to create the Init kernel thread, then run Cpu_idle, become the Idle process
Control of the baton from the Bios-->bootloader-->idle, to a certain extent, is to complete the subsystem initialization mission, will be relegated to the second-tier. Process No. 0 has been in the palace "kernel State", not out of the palace "to the user state", the so-called noble life.
Code outline for process number No. 0
The stack sample into loop is as follows:
(gdb) bt#0  cpu_idle_loop () at kernel/sched/idle.c:201#1  cpu_startup_entry (state=<optimized out>) at Kernel/sched/idle.c:274#2  0xc175d22d in Rest_init () @ init/main.c:418#3  0xc1a4bb59 in Start_kernel () at init/ Main.c:680#4  0xc1a4b360 in I386_start_kernel () @ arch/x86/kernel/head32.c:49#5  0x00000000 in?? ()
Come on, there's a few dynamic libraries in the bar, showing the stack that goes into the loop, and the code running in the loop.


User 1th process of past life
Process 1, also known as the Init process, is the ancestor of all user processes by process 0 in Start_kernel call Rest_init to create the init process PID 1, when the scheduler chooses to the INIT process, the init process starts executing kernel_init () Function init is a common user-state process, which is the interface between the kernel initialization and user-state initialization of the UNIX system, which is the ancestor of all user processes. Before running INIT, the kernel initialization is the last action of the process (kernel initialization) is to run the/sbin/init executable file


Proof of concept:
Key code Location:
User-State process: Look at the stack. (nuclear mentality into the kernel, check)



Appendix:Topic self-proposed, the content revolves around the Linux kernel boot process, namely starts from Start_kernel to the INIT process;
You need to use an experiment in your blog
The execution of the Start_kernel function needs to be carefully analyzed in the blog content
The summary section needs to clarify its understanding of the "Linux system startup process", especially how the idle process, process 1th is coming.


The ancestors of all processes are called processes 0
A kernel thread that was manually created by the Start_kernel () function from scratch during the system initialization phase
Process 0 The final initialization work creates the Init kernel thread, and thereafter runs Cpu_idle, which becomes the idle process

Proof of concept:
Main flowchart
(start)--->rest_init---> (dispatched)--in one loop

Process 1, also known as the Init process, is the ancestor of all user processes
Created by process 0 called Rest_init in Start_kernel
The init process PID is 1, and when the scheduler chooses to the INIT process, the INIT process starts executing the kernel_init () function
Init is an ordinary user-state process, which is the interface between the kernel initialization and user-state initialization of the UNIX system, which is the ancestor of all user processes. Before running INIT, the kernel initialization is the last action of the process (kernel initialization) is to run the/sbin/init executable file
Proof of concept:
Key code Location:
User-State process: Look at the stack. (nuclear mentality into the kernel, check)

Appendix:Topic self-proposed, the content revolves around the Linux kernel boot process, namely starts from Start_kernel to the INIT process;
You need to use an experiment in your blog
The execution of the Start_kernel function needs to be carefully analyzed in the blog content
The summary section needs to clarify its understanding of the "Linux system startup process", especially how the idle process, process 1th is coming.

Thinking on the related process of Linux Start_kernel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.