-
Process Identifiers
Every process has unique process ID, a non-negative integer. Process ID 0 is swapper. Process ID 1 is usually the init process and is invoked by the kernel at the end of the bootstrap procedure. The init process never dies. It is a normal user process, not a system process within the kernel, like the swapper, although it does run with super user privileges.
-
Fork Functionpid_t fork( void )
A technique called copy-on-write (COW) is used. These regions are shared by the parent and child and have their protection changed by the kernel to read-only. If either process tries to modify these regions, the kernel then makes a copy of that piece of memory only, typically a “page” in a virtual memory system.
The parent and child share a file table entry for every open descriptor. It is import that the parent and child share the same of file offset.
-
Child process inherited from parent process:
-
Real user ID, real group ID, effective user ID, effective group ID
-
Supplementary group ID
-
Process group ID
-
Session ID
-
Controlling terminal
-
The set-user-ID and set-group-ID flags
-
Current working directory
-
Root directory
-
File mode creation mask
-
Signal mask and dispositions
-
The close-on exec flag from any open file descriptors
-
Environment
-