The following list may change due to different UNIX implementations, so the accuracy may be compromised. Note that sub-processes get copies of these things, not themselves.
The child process inherits from the parent process:
①Process qualification (real)/valid (valid)/saved (saved) user number (UIDs) and group number (gids ))
②Environment (Environment)
③Stack
④Memory
⑤Open the file descriptor (note that the location of the corresponding file is shared by the parent and child processes, which may cause ambiguity)
⑥The close-on-exec Mark (close-on-exec) mark can be set through fnctl () to the file description, posix.1 requires that all directory streams be disabled when the exec function is called. For more details, see w. R. Steven S, 1993, and Yujin yuan (hereinafter referred to as "advanced programming"), Section 3.13 and section 8.9)
7.Signal Control settings
BytesNice value: the nice value is set by the Nice function. This value indicates the priority of the process. The smaller the value, the higher the priority)
BytesScheduler class, process SchedulingProgramGlobal process prority can be calculated for each process, and processes with higher priority are executed preferentially)
BytesProcess Group Number
11Session ID: The session ID of a process, A dialog contains one or more process groups. For more information, see section 9.5 of advanced programming)
12Current working directory
13Root directory (the root directory is not necessarily "/", which can be changed by the chroot function)
14File mode Creation mask (umask)
15Resource restrictions
16Control Terminal
Unique to sub-processes:
①Process number
②Different parent process numbers (note: the parent process numbers of child processes are different from those of parent processes. The parent process numbers can be obtained by the getppid function)
③Copy your own file descriptor and directory stream (Note: The Directory stream is created by the opendir function because it is read sequentially, so it is called "directory stream ")
④The sub-process does not inherit the process, text, data, and other locked memory (memory locks) of the parent process, the kernel is not allowed to swap it out (page out) when necessary. For details, see section 2.2, 1999, 3.4.2 of the gnu c library reference manual)
⑤System Time in the TMS structure (Note: The TMS structure can be obtained by the times function, which stores four pieces of data used to record the time when the process uses a central processing unit (CPU: Central Processing Unit), including: user time, system time, total time of each sub-process, and total time of each sub-process in the system)
⑥Resource utilizations is set to 0
7.The blocked signal set is initialized as a blank set (the original text is not clear here, and the translation is slightly modified according to the fork function manual page)
BytesDo not inherit the timer created by the timer_create Function
BytesDo not inherit asynchronous Input and Output
Original article:
This article is transferred from:
Http://www.cnblogs.com/hnrainll/archive/2011/05/11/2043472.html