Created
October 18, 2019 18:17
-
-
Save archi144/217183f647574033ebd1673846df9c3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc,char* argv[]) | |
{ | |
cout<<"\nРодительский PID: " << getpid()<< "\nРодительский PPID: "<< getppid()<< "\nРодительский GPID: "<< getgid() << endl; | |
int status = fork(); | |
if(status) | |
{ | |
cout<<"\nВыполняется родительский процесс..."<<endl; | |
cout<<"\nВозвращаемый код fork: " << status << endl; | |
cout<<"Родительский PID: " << getpid()<< "\nРодительский PPID: "<< getppid()<< "\nРодительский GPID: "<< getgid() << endl; | |
pause(); | |
} | |
else | |
{ | |
cout<<"\nВыполняется дочерний процесс..."<<endl; | |
cout<<"\nВозвращаемый код fork: " << status << endl; | |
cout<<"Дочерний PID: " << getpid()<< "\nДочерний PPID: "<< getppid()<< "\nДочерний GPID: "<< getgid() << endl; | |
pause(); | |
} | |
cout<<"status : "<<status<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment