Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

1. List the basic factors determining pay rates.pg 87

Answered: 1 week ago