Menu

[Solved] Write a program children.c, and let the parent process produce two child processes

Write a program children.c, and let the parent process produce two child processes. One prints out “I am child one, my pid i ” PID, and the other prints out “I am child two, my pid is: “PID. Guarantee that the parent terminates after the children terminate (Note, you need to wait for two child processes here). Use the getpid() function to retrieve the PID

Expert Answer


Code:

#include <stdio.h>

int main() {
int fork1 = fork();
if (fork1 < 0) {

answer image blur

OR