[[Email protected] ~] $ PS-Ef | grep init
Root 1 0 0 apr24? 00:08:25 init [3]
[[Email protected] ~] $ PS-Ef | head-N 1
Uid pid ppid C stime tty time cmd
The second and third columns are the current process ID and parent process ID.
P1: process 0 fork indicates the INIT process with the root permission of process 1, and process 1 (Note: process 0 is the first process started by the system, and it is the ancestor of all other processes, after the process becomes an orphan process, it will be taken over by the process no. 0)
P2: Process 1 fork SSH Logon Process for sshd, process 1994
P3: process fork No. 1994 logs out of the personal [luwenwei] logon process, 11315
P4: Process 11315 fork goes out of the SSH management process, and 11319 takes over all SSH Login terminal windows. This step is in the user State (the user name is luwenwei ), then the process owner switches to luwenwei.
P5: Process 11319 fork goes out of a single terminal window, 24106, the current shell (BASH) Process
About the new window: If you need to open a new terminal, you need to apply to the terminal management process (11319), 11319 will fork a PTS bash Process
About the current window: The current terminal window number is 13, and the corresponding bash number is 24106
P6: run the PHP process in the current shell. The fork process on the 9th generates the PHP process on the 9th.
P7: Execute the sleep command (Exec ('sleep 5') in the PHP program. The 1423 PHP process fork generates the 1424 sleep process.
P1 root 1 0 0 apr24? 00:08:25 init [3]
P2 root 1994 1 0 apr24? 00:00:07/usr/sbin/sshd
P3 root 11315 1994 0? 00:00:00 sshd: luwenwei [priv]
P4 luwenwei 11319 11315 0? 00:00:00 sshd: [email protected]/2, pts/7, pts/13, pts/20
P5 luwenwei 24106 11319 0 00:00:00 pts/13-Bash
P6 luwenwei 1423 24106 1 00:00:00 pts/13 php a. php
P7 luwenwei 1424 1423 0 00:00:00 pts/13 sleep 5