Question
a)What, to whom and how many values a fork system call returns? b)Assuming there is no syntax error, what is the output for the following
a)What, to whom and how many values a fork system call returns?
b)Assuming there is no syntax error, what is the output for the following C program for linux? All of you may need to put screenshot of your PC in which Terminal login must be your arid number.
int main()
{ pid_t fork_return;
fork_return = fork();
if (fork_return == 0) {
execlp("/bin/ls", "ls", NULL);
printf("Child process ID: %d", getpid());
exit(0);
}
else { wait (NULL);
printf("Parent process ID: %d", getpid());
}
return 0;
}
Step by Step Solution
3.46 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
Fork Fork system call is used to create a new process This newly created p...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 StartedRecommended Textbook for
Modern Operating Systems
Authors: Andrew S. Tanenbaum, Herbert Bos
4th edition
013359162X, 978-0133591620
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App