Create a Linux Process
# Include <unistd. h>
# Include <sys/types. h>
Pid_t fork ();
The fork function generates system calls for new processes in Linux.
The relationship between the parent process and the child process is the relationship between management and management. When the parent process ends, the child process also ends. However, when a child process is terminated, the parent process may not be terminated.
-----------------------------------------------------------------------
Process Management
Start Process
There are two main ways to start a process: Manual start and scheduling start. The latter is set in advance and started according to user requirements. If you run a command to directly start a process, you can manually start the process.
Manual start processes can be divided into foreground start and background start. Foreground start means to directly execute executable programs, and background start means to add "&" (with spaces) after the executable statements)
-----------------------------------------------------------------------
Process Scheduling
When a foreground process needs to be interrupted, the CTRL + C key combination is usually used.
However, for a background process, it cannot be solved by a combination of keys. In this case, you must use the kill command.
-----------------------------------------------------------------------
Init
Init is the first process executed in Linux. The process ID is 1, which is the starting point of all processes in the system. It is mainly used to execute some boot initialization scripts and monitor processes. The Linux system starts to run the INIT program after kernel boot. The INIT program needs to read the configuration file/etc/inittab. Inittab is an unexecutable text file consisting of several lines of commands.