Linux Process Learning (2)

Source: Internet
Author: User

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.

 

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.