Actual User: Indicates who you are, who is running it, used to identify information eg: ID card, invitation status, non-member
Valid users: Whether a resource has some kind of permission, the process may access some resources, ordinary users can not bear, identity changes to access resources
For example: Under the Linux system, the root user or the ordinary user can use the passwd command to modify the password, change the password mainly by modifying etc files to achieve, and shadow file permissions all empty, only Root has permission to modify this file. Therefore, when the ordinary user executes the passwd command, its privileges are improved in a flash, and run with owner privileges.
Guess the result of the run, will print a few messages??
#include <stdio.h> #include <unistd.h> #include <sys/types.h>int main () { int i=0; pid_t id; for (; i<2;++i) { id=fork (); if (id==0) {/ /child printf ("pid: %d,ppid: %d\n", Getpid (), Getppid ()); } else if (id>0) {//father printf ("pid: %d,ppid: %d\n", Getpid (), Getppid ()); } } return 0;}
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7E/AD/wKioL1cHLsfgIX6AAAAnxBuClHU770.png "style=" float: none; "title=" QQ picture 20160408115214.png "alt=" Wkiol1chlsfgix6aaaanxbuclhu770.png "/>
The running result shows that the child process is created with fork () and the same program as the parent process is executed (but different code branches may be executed: if condition judgment shunt)
The back of the Ppid for 1 showed that they had become orphans and were adopted by the process 1th.
#include <stdio.h> #include <unistd.h> #include <sys/types.h>int main () { int i=0; pid_t id; for (; i<2;++i) { id=fork (); if (id==0) {/ /child printf ("pid: %d,ppid: %d\n", Getpid (), Getppid ()); } else if (id>0) {//father printf ("pid: %d,ppid: %d\n", Getpid (), Getppid ()); } } printf ("pid: %dhello\n", Getpid ()); return 0;}
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/B0/wKiom1cHLhnTJIPdAAAqPArGxd4865.png "style=" float: none; "title=" QQ picture 20160408115909.png "alt=" Wkiom1chlhntjipdaaaqpargxd4865.png "/>
This article is from the "Small Stop" blog, please be sure to keep this source http://10541556.blog.51cto.com/10531556/1761685
Process creation analysis under Linux