Question: Type the following C program to see the function of exec() system call: #include char *myargs[] = { ls, -l, NULL }; int main() {

Type the following C program to see the function of exec() system call:

#include

char *myargs[] = {

"ls",

"-l",

NULL

};

int main()

{

int i;

if (fork()==0)

{

execvp("ls",myargs);

printf("NEVER PRINTED ");

exit(0);

}

else

{

for (i=0;i<5;i++)

{

printf("PARENT: %d ",i);

sleep(1);

}

}

printf("DONE ");

return 0;

}

Questions:

How could you convert the parent to a long-running process? Convert it and then put it in the background. Report the status and PID.

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!