After fork, what does a subprocess inherit from the parent process?

Source: Internet
Author: User
Tags session id

It is helpful to know what the child process inherits or inherits from the parent process. The following list will change because of the implementation of different UNIX, so perhaps the accuracy has been watered down. Note that the child process gets the copy * of these things, not themselves.

The child process inherits from the parent process to:

Qualification of processes (true (real)/valid (Effective)/saved (saved) user number (UIDs) and group number (Gids))

Environment (Environment)

Stack

Memory

Opening a descriptor for a file (note that the location of the corresponding file is shared by the parent-child process, which can cause ambiguity)

Shutdown (CLOSE-ON-EXEC) flag on Execution (note: The CLOSE-ON-EXEC flag can be set by Fnctl () to the file descriptor, POSIX.1 requires that all directory streams be closed on EXEC function calls. For more information, refer to the UNIX environment Advanced Programming W. Stevens, 1993, Yu Jinyuan, etc. (hereinafter referred to as "advanced Programming"), 3.13 sections and 8.9 sections)

Signal (signal) control settings

Nice value: The nice value is set by the Nice function, which indicates the priority of the process, the smaller the value, the higher the priority.

Process scheduling category (Scheduler Class) (Translator Note: The process scheduling category refers to the class in which the process is scheduled in the system, different classes have different priorities, and the process Scheduler calculates the global priority of each process based on the process scheduling category and nice values) (Global process prority), high priority process priority implementation)

Process Group number

Dialog period ID (session ID) Translator Note: The translation is derived from advanced programming, which refers to the session ID of the process to which it belongs, a session that includes one or more process groups, in more detail, see "Advanced Programming" section 9.5.

Current working directory

Root directory (Translator note: The root directory is not necessarily "/", it can be changed by the chroot function)

File mode Create a mask word (file mode creation mask (umask)) (translated from "Advanced Programming" means: Create a new file with the default screen word)

Resource constraints

Control Terminal

Unique to the child process:

Process number

Different parent process Number (Translator Note: The parent process number of the child process is different from the parent process number, and the parent process number can be obtained by the GETPPID function)

Your own file descriptor and copy of the directory stream (translator Note: directory flow created by the Opendir function, which is read sequentially, gu "directory Flow")

The child process does not inherit the process of the parent process. Body (text), data, and other locked memory (memory locks): Locked memory refers to the locked virtual memory page, locked, does not allow the kernel to swap it out when necessary (page out), details see "The GNU C Library Reference Manual 2.2 Edition, 1999, 3.4.2)

System time in TMS structure: The TMS structure can be obtained by the Times function, which holds four data to record the time that the process uses the central processor (cpu:central processing unit), including: User Time, System time, total time of the user's child process, Total time of the system sub process)

Resource Usage (resource utilizations) set to 0

Block signal set initialized to empty (translator Note: The original text here is not clear, the translation according to the Fork function manual page slightly modified)

Timers created by the Timer_create function are not inherited

Do not inherit asynchronous input and output

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.