Answered step by step
Verified Expert Solution
Link Copied!

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

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago