Question: Program A code: //Note: pipes are not bi-directional, so you will need two pipes per process, one for receiving (reading) and one for sending (writing).

Program A code:
//Note: pipes are not bi-directional, so you will need two pipes per process, one for receiving (reading) and one for sending (writing). if you the to send (write) something using pipe1 you need to close the reading end of that pipe, namely close(pipe1[0]). In the same way, if you need to receive something from the someone, you have to use another pipe, let say pipe2, so you use the reading end part and close the writing end, namely close(pipe2[1]) */ //Sorry for any typo, I hope that this code will help you to beeter understand, how to use the API for process. Feel free to extend this code for two and three childrens. #include #include #include #include int main(int argv, char** argc) { // initialize pipes int p1[2]; int p2[2]; pipe(p1); pipe(p2); int luis; int numElements = 6; /um of elements in the array luis = fork(); //creating a child if (luis == 0) { // If I am the child read the elements of the array that my parent sent me close(p1[1]); //closing the writing end of pipe1 (p1), I am using p1 for reading so p1[0] is open for reading from my parent close(p2[0]); //closing the reading end of pipe2 (p2), I am using p2 for sending (writing) the sumation to my parent int vals[numElements]; read(p1[0], &vals, sizeof(vals)); // compute the sum int sum = 0; printf("child %d: received ", getpid()); //printing my pid and the array that I just received from my parent int i; for (i=0;i ProgramB Here, you can recycle most of the code from ProgramA. The only difference is that now the parent program will create a variable number of children (for this problem 2 or 3) instead of just one child, and it will send a piece of the array to each child. Each child will compute the summation of its array and it will print it along with its process ID Then, each child will send the summation to its parent. The parent will collect the partial