3 Creation and Execution of Process 1
3.1 Creation of Process 1
Now, process 0 is at privilege level 3, which is a process state. As a parent process, its first task is to call fork() to create the first child process—process 1, which is the first implementation of the parent–child process-creating mechanism. On the basis of this mechanism, all processes are created by the parent process later.
3.1.1 Preparation for Creating Process 1
In Linux, any new process is created by calling fork(). The procedure is shown in Figure 3.1.
The code is as follows:
//code path:init/main.c: ......static inline _syscall0(int,fork)//correspond to forkstatic ...
Get The Art of Linux Kernel Design now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.