Home > Back-end >  Questions about process of father and son
Questions about process of father and son

Time:09-22

The code below
 # include "is basic. H" 
Int main (int arg c, char * argv [])
{
///*
Pid_t pid, ppid, a pgid;

Pid=getpid ();
Printf (" pid=% d \ n ", pid);

Ppid=getppid ();
Printf (" ppid=% d \ n ", ppid);

A pgid=getpgid (pid);
Printf (" a pgid=% d \ n ", a pgid);
return 0;
}


Run the result of the parent process in the different environment, different
Ubuntu 18.04 ppid to bash process, process id 4110
Ubnutu ppid under 18.04 root access for another bash process, can be found by ps - a process id 4895

Not to say that no parent will hang the init process, the general process of the init process number 1?

O god, thank you

CodePudding user response:

Then how did you execute a program? Is to open a terminal, terminal launched by default bash (otherwise. The following definitions of what environment variables are read in)?
If so, then your parent is bash no problem
  • Related