Question: Write a C program that creates 2 child processes (C1 and C2) and 2 pipes and support sending an unlimited number of messages between the


Write a C program that creates 2 child processes (C1 and C2) and 2 pipes and support sending an unlimited number of messages between the parent and either of the 2 child processes as shown in Figure 1 below. Parent C2 C1 Figure 1: Communication between a parent and 2 child processes The parent process reads the ID of the destination process as well as the message itself from the user and sends the message through the correct pipe to its intended destination. The parent, sender process, ignores any messages that are destined to neither of the children. As soon as a child process receives a message it prints it to the screen as shown in the sample run below (Figure 2). The parent process will keep on reading messages from the user and sending them to the destination processes until the user types -1 for the ID of the destination. It then closes all open pipes and terminates. Please test for the success of the different system calls you use in your code, and make sure that the parent process waits for its children before it terminates
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
