Because the kernel identifier of the init() function and the process identifier of the init process are both 1, they are called init, so the init() function and the init process are easy to conceptualize. Unclear.
The main difference:
1, the init() function is part of the kernel code, runs in kernel mode and is part of the stand-alone executable code.
2, init process in the Linux operating system
is a special process, it is the first user process started and run by the kernel, so it is not running in the kernel state Instead, it runs in user mode. Its code is not part of the kernel itself, but is stored in the image of the executable on the hard disk, no different from other user processes.
Process No. 0--> Kernel Thread No. 1->> Kernel Process No. 1-->init Process (User Process No. 1)
Process No. 0: This is the system A process that is automatically formed at boot time is actually the kernel itself. It is the ancestor of all the processes that are later produced in the system. When the kernel system completes its own initialization, the kernel itself calls the function kernel_thread(), which creates the first kernel thread using the int 0x80 system call.
No. 1 kernel thread: The so-called kernel thread, in Linux system refers to the process without virtual storage space, the kernel thread can directly use the physical address space, running in the kernel state. After the soft interrupt system call returns, the parent and child processes are determined by comparing the values of the ESP and ESI registers. If the value of the ESP register is equal to the value of the ESI register, the system considers it to be the parent process, the kernel itself, which is the process number 0. Otherwise it is the first kernel thread created by the kernel. So this thread is the number 1 thread.
No. 1 kernel process: If it is the kernel thread No. 1, the program controls the subroutine to directly execute the init() function. Then, the No. 1 thread will evolve into the No. 1 kernel process.
init process: The init() function calls execve() to load the executable program init() from the file /etc/inittab and execute it. From then on, the kernel process of the init() function evolves to the init process. . In other words, the init process is generated by the init() function. The fork() is not used in this evolution, so the process identifier of the init process is still the identifier 1 of the kernel process number 1. Seeing this, I suddenly remembered that in the embedded root file system, I also executed the init thread of the kernel first. The thread will execute the script. /linuxrc. At the end of the ./linuxrc: execve /sbin/init, go to execute the user. The init process of the space, which will execute the script inittab (if any).
view mysql default encoding format show variables like “character%”; If the reality-bash
ifconfig -a View all NIC information of Linuxifconfig eth0 down Turn off eth0 network cardifconfig e
Mono is a cross-platform, open source .NET development framework. Support for Linux systems, which
Computer store news: Do you remember that Steam is ready to host? Now there is new news: this hardwa
Centos 6.x configuration based on nginx's wordpress runtime environment
A detailed introduction to Debian
The samba service is not installed and the dual-system boot fails.
Physical address to virtual address mapping
Apache's prefork mode and worker mode The
Stack in Linux: User State Stack /Kernel Stack /Interrupt Stack
Rm delete the file or directory at the beginning of the dash
What does the Unix/linux kernel play in the system?
Instance resolution: Linux system transparent firewall related settings
Amazon amozon AMI instance automatically installs Nginx script
Teach you how to complete Linux network address configuration
Win7 system computer can not play after using the text
Win8 easily creates a familiar Windows traditional desktop environment
What should I do if the Win10 screen resolution cannot be adjusted?
Jinshan Guardian Some tips you may not know
Win8 system right-click resource manager is always restart how to solve?
XP Tips: Cancel the "low disk space" prompt
"Operating System Not Found" error message appears when starting up and resolves
How to make special characters of Win7 system? How to use homemade special characters?