a. What will be the output of LINE A in code “a†and output ofcode “b� Also write
reasons for the outputs.
a. #include
#include
#include
int value = 3;
int main()
{
pid_t pid;
pid = fork();
if (pid = = 0) {/* child process */}
value += 233;
return 0;
}
else if (pid > 0) {/* parent process */}
wait(NULL);
printf(“PARENT: value = %dâ€, value); /* LINE
A */
return 0;
} }
b.
#include
#include
int main()
{
/* fork a child process */
fork();
/* fork another child process */
fork();
/* fork another child process */
fork();
/* and fork another */
fork();
return 0;
}