Question: Process management questions (definitions for programs prl and pr2) prl: pr2: int main(int argc, char **argv) { int main(int argc, char **argv) ( pid_t pidi,

 Process management questions (definitions for programs prl and pr2) prl: pr2:
int main(int argc, char **argv) { int main(int argc, char **argv) (

Process management questions (definitions for programs prl and pr2) prl: pr2: int main(int argc, char **argv) { int main(int argc, char **argv) ( pid_t pidi, pid2; pid t pid; pidi - fork(); if (pidi - 0) { printf ("P1 child "); execlp("./pr2", "pr2", "fork 1", NULL); } else { printf ("P1 original "); wait (NULL); printf ("P2 *s ", argv[1]); pid fork(); if (pid > 0) { wait (NULL); printf ("P2 parent s ", argv[1]); } else if (pid -- 0) printf ("P2 child *s ", argv[1]); return 0; pid2 fork(); if (pid2 0) ( printf ("Child of P1 "); I execlp("./pr2", "pr2", "fork 2", NULL); } else { printf ("Still P1 original "); wait (NULL); } } return 0; ) Note: prl always runs first and is invoked with the command line: . /prl Process management questions (definitions for programs prl and pr2) prl: pr2: int main(int argc, char **argv) { int main(int argc, char **argv) ( pid_t pidi, pid2; pid_t pid; pidi - fork(); if (pidi - 0) { printf ("P1 child "); execlp ("./pr2", "pr2", "fork 1", NULL); } else { printf ("P1 original "); wait (NULL); printf ("P2 *s ", argv[1]); pid fork(); if (pid > 0) { wait (NULL); printf ("P2 parent %s ", argv[1]); } else if (pid -- 0) printf("P2 child *s ", argv[1]); return 0; pid2 fork(); if (pid2 0) ( printf ("Child of P1 "); I execlp ("./pr2", "pr2", "fork 2", NULL); } else { printf ("Still P1 original "); wait (NULL); ) } return 0; Note: prl always runs first and is invoked with the command line: . /pri Process management questions (definitions for programs prl and pr2) prl: pr2: int main(int argc, char **argv) { int main(int argc, char **argv) ( pid_t pidi, pid2; pid t pid; pidi - fork(); if (pidi - 0) { printf ("P1 child "); execlp("./pr2", "pr2", "fork 1", NULL); } else { printf ("P1 original "); wait (NULL); printf ("P2 *s ", argv[1]); pid fork(); if (pid > 0) { wait (NULL); printf ("P2 parent s ", argv[1]); } else if (pid -- 0) printf ("P2 child *s ", argv[1]); return 0; pid2 fork(); if (pid2 0) ( printf ("Child of P1 "); I execlp("./pr2", "pr2", "fork 2", NULL); } else { printf ("Still P1 original "); wait (NULL); } } return 0; ) Note: prl always runs first and is invoked with the command line: . /prl Process management questions (definitions for programs prl and pr2) prl: pr2: int main(int argc, char **argv) { int main(int argc, char **argv) ( pid_t pidi, pid2; pid_t pid; pidi - fork(); if (pidi - 0) { printf ("P1 child "); execlp ("./pr2", "pr2", "fork 1", NULL); } else { printf ("P1 original "); wait (NULL); printf ("P2 *s ", argv[1]); pid fork(); if (pid > 0) { wait (NULL); printf ("P2 parent %s ", argv[1]); } else if (pid -- 0) printf("P2 child *s ", argv[1]); return 0; pid2 fork(); if (pid2 0) ( printf ("Child of P1 "); I execlp ("./pr2", "pr2", "fork 2", NULL); } else { printf ("Still P1 original "); wait (NULL); ) } return 0; Note: prl always runs first and is invoked with the command line: . /pri

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!