Arid No is 19-arid-898
Question 3: [2+2]
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\n", getpid());
exit(0);
}
else { wait (NULL);
printf("Parent process ID: %d\n", getpid());
}
return 0;
}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Question 3: [2+2] 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
Question 3: [2+2]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\n", getpid()); exit(0); } else { wait (NULL); printf("Parent process ID: %d\n", getpid()); } return 0;}
Edit the code (shell.c) given to do the tasks asked! will rate
for correct answer! Also, include a screen shot of the output and
terminal window of each command you used. Read carefully to do this
task please.
shell.c code given below.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <string.h>
int main()
{
int PID;
char lineGot[256];
char *cmd;
while (1){
printf("cmd: ");
fgets(lineGot, 256, stdin); // Get a string from user (includes \n)
cmd = strtok(lineGot, "\n");...