Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program should be in C using Linux System calls More on Pipes Objective - To better understand the use of pipes to communicate between

image text in transcribedimage text in transcribed

This program should be in C using Linux System calls

More on Pipes Objective - To better understand the use of pipes to communicate between processes Submission One compressed file that contains all C and pdf files Make sure to do the following - Check the success of every system call you use - When using pipes, make sure to close the pipe-side the process will not use Description In this lab, we'll write a program to illustrate the basics of process creation and IPC to facilitate communication between three processes using pipes Send messages to child processes 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 1. 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. Your program should behave as follows More on Pipes Objective - To better understand the use of pipes to communicate between processes Submission One compressed file that contains all C and pdf files Make sure to do the following - Check the success of every system call you use - When using pipes, make sure to close the pipe-side the process will not use Description In this lab, we'll write a program to illustrate the basics of process creation and IPC to facilitate communication between three processes using pipes Send messages to child processes 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 1. 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. Your program should behave as follows

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

Step: 3

blur-text-image

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

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions

Question

5. Develop a self-management module for a training program.

Answered: 1 week ago