Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started