Question
Suppose We Have Three Programs Aaa, Bbb, Ccc Which Are Already Developed, Compiled And Ready To Execute. The First Two, Namely Aaa And Bbb, Simply
Suppose We Have Three Programs Aaa, Bbb, Ccc Which Are Already Developed, Compiled And Ready To Execute. The First Two, Namely Aaa And Bbb, Simply Do Some Random Amount Of Computation And Write A Character (Respectively, 'A' And 'B To STDOUT_FILENO In A Loop That Is Repeated 1000 Times. If We Run Both Programs At The Same Time, We Might See Different Numbers
I---| child2 (bbb) [1] ->I I mypipe -> [0]child3 (ccc) You can ignore most of the error checking to make your code clear, but you need to close all unnecessary file/pipe descriptors and need to check what fork0 returns to detect child/parent proceees and/or what read0/writeO returns to detect end of file etc. To execute a given program simply use execl (aaa, aaa , NULL); etc. /your implementation of xyz.c / #include #include #include #include int main (int argc, char argv[]) int mypipe [2]; int child1=1, child2-1, child3-1; /*parent: create mypipe and children processes (3pt)" style='width:475.2pt;height:502.8pt;visibility:visible;mso-wrap-style:square'> I---| child2 (bbb) [1] ->I I mypipe -> [0]child3 (ccc) You can ignore most of the error checking to make your code clear, but you need to close all unnecessary file/pipe descriptors and need to check what fork0 returns to detect child/parent proceees and/or what read0/writeO returns to detect end of file etc. To execute a given program simply use execl (aaa, aaa , NULL); etc. /your implementation of xyz.c / #include #include #include #include int main (int argc, char argv[]) int mypipe [2]; int child1=1, child2-1, child3-1; /*parent: create mypipe and children processes (3pt)" v:shapes="Picture_x0020_72">
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started