Linux Process 0 and INIT process 1

Source: Internet
Author: User

Linux Process 0 and INIT process 1
Process 0: the first process created in Linux boot. After the system is loaded, it becomes a process scheduling, switching, and storage management process.
Process 1: The INIT process, created by the 0 process, initializes the system. It is the ancestor process of all other user processes in the system.
In Linux, process 1 is created by process 0. Therefore, you must know how to create process 0,ProgramThe process has been running in the kernel state, while the process is running in the user State. Therefore, the creation of process 0 involves changes in the privileged level, from the privileged level 0 to the privileged level 3, in Linux, a privileged-level change is realized by simulating the interrupt return and the process 0 is created.CodeSegment Selection Sub-and program counter EIP is directly pushed into the kernel state stack, and then the iret Assembly command is used to interrupt the return to jump to process 0 to run.
The Code is as follows:
Move_to_user_mode (); // create process 0, start to enter process 0, and switch to privileged level 3 for running
If (! Fork () {Init ();} // create process 1

In Linux, what are the consequences of sending a termination signal to the INIT process using the kill function?
The INIT process is a special process that neither receives nor processes signals. There is no result when you send an end signal to it.
The following is the 2.4.0 kernel.Source codeComments in front of the do_signal () function in:
/** Note that 'init 'is a special process: it doesn' t get signals it doesn' t * want to handle. thus you cannot kill init even with a sigkill even by * Mistake. */

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.