Linux fork inherited and not inherited

Source: Internet
Author: User
A fork system call generates a new process called a sub-process, which is a complex process called.
Product. The Calling process is called the parent process. The child process inherits almost all of the parent processes.
Actual uid, GID and valid uid, GID.
. Environment variable.
. Add GID.
. The flag to close when exec () is called.
. Uid Setting Mode bit.
. GID sets the bitwise of the mode.
. Process Group number.
. Session ID.
. Control terminal.
. Current working directory.
. Root directory.
. File Creation mask umask.
. File length limit ulimit.
. Pre-value, such as priority and any other process pre-parameter, depending on the type
Decide whether to inherit.
. There are some other attributes. However, sub-processes have different attributes from parent processes:
. Process number. The sub-process number is different from the process group number of any activity.
. Parent process number.
When a child process inherits the file descriptor or stream of the parent process, it has its own copy
And share the resource with the parent process and other child processes.
The user time and system time of the sub-process are initialized to 0.
The timeout clock of the sub-process is set to 0.
. The sub-process does not inherit the record lock of the parent process. Pending signals will not be inherited.

In Linux, fork is implemented by copy-on-write, that is, the child process and the parent process are different only from the page table and task structure at the beginning.

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.