#include #include using namespace std; int main() { cout << endl << endl; pid_t forkValue {fork()}; string cmd = "head -10 /proc/self/status"; switch(forkValue) { case 0: cout << getpid() << " is the child" << endl; cout << getpid() << " is the parent " << endl; cmd = "ps -efH | grep " + to_string (getpid()); cout << endl; cout << "Executing " << cmd << endl; system(cmd.c_str()); sleep(2); cout << endl; cout << "Executing " << cmd << endl; system(cmd.c_str()); cout << endl; return 0; default: usleep(100); cout << getpid() << " the parent, is now exiting" << endl; return 0; } }