- Make child 1 function - split the pipe through fork()
- Make child 2 function - split the pipe through fork()
- Make parent - Makes the pipe
- Make branch for group
- Create one pipe (ear/read, mouth/write)
- Pipe is used for communication between the children
- Fork off child 1 → Child 1 inherits the pipe
- Fork off child 2 → Child 2 inherits the same pipe
- Close both ends of the pipe
- Waits for both children to die
- First closes the read end of the pipe
- Uses
dup2()to replace its existing stdout by the write end of the pipe - Closes the write end of the pipe
- Replaces its executable by
./tacousingexecvp()
- Closes the write end of the pipe
- Uses
dup2()to replace it’s existing stdin by the read end of the pipe - Closes the read end of the pipe
- Replaces its executable by
./gatousingexecvp()
madre is connected to the kayboard in standard input, its gonnabe connected to
the screen, madre is gonna have a child or 2 children, child 1 which replaces
itself by becoming taco. child 2 replaces itself by gato. child 1 will not touch
its stadn input so its gonna be connected to the kyaboard on the stdout is gonna
use the pipe he inherited from madre go to child2 who also inherited, child2 will
not touch its standout which means still goes to the screen in the end it, when u type
taco will reverse it line by line and spit it out to child 2 gato which just repeats
it.