Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This problem builds significantly on the previous problem. Specifically, it asks you to again use fork() to create processes and exec() (or one of the
This problem builds significantly on the previous problem. Specifically, it asks you to again use
fork() to create processes and exec() (or one of the many variants) to assign the newly created
processes what to do. In addition, however, it asks you to mimic the behavior of a shell command
such as:
ls | wc
What happens in the case above is the output of the first command (ls) becomes the input
to the second command (wc). (Try it in a terminal on a Unix machine).
Thus, you are required to write another program that:
Expects an input of the form: cmd1 | cmd2
Creates two processes
Makes the first process run cmd1
Makes the second process run cmd2
Makes sure that the output of the first process becomes the input of the second process (using
the function pipe()).
Waits for the two processes to finish before it ends by printing ++++ on a new line.
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