#include #include using namespace std; int main() { cout << "The parent PID is " << getpid() << endl; cout << endl; pid_t pid{fork()}; cout << endl; cout << "After Fork, my pid is " << getpid() << " and I got " << pid << endl; cout << endl; if (pid != 0) { sleep(1); cout << "The parent here, byby" << endl; exit(0); } cout << "My pid is " << getpid() << endl; cout << "My Parent PID is " << getppid() << endl; cout << endl << endl; // give the parent time to exit; sleep(2); cout << "My pid is " << getpid() << endl; cout << "My Parent PID is " << getppid() << endl; return 0; }