Question: C++ homework using forks which will do the following: Sample output will look like this: hello.cpp is a given file and is shown above 1.

C++ homework using forks which will do the following:

C++ homework using forks which will do the following: Sample output will

Sample output will look like this:

look like this: hello.cpp is a given file and is shown above

hello.cpp is a given file and is shown above

1. forks and makes the parent wait for its child (child1) 2. child1 then forks and waits for it's first child (child2) 3. child2 prints out a list of the present working directory contents (ls-1 4. childl then forks and waits for it's next child (child3) 5. child3 displays the contents of hello.cpp 6. child1 then forks and waits for it's next child (child4) 7. child4 compiles hello.cpp creating hello.out (g+hello.cpp -o hello.out) 8. child1 then runs hello.out passing 2 as command line argument ( hello.out 2) parent announces that child has finally exited tundu, m t c Users OneOm e csulb 19s 19s_12b/19s_1cb Lectures weti 05 031-Processes, reston L5DCompiel dRu Hello $./a.out PARENT: Waiting for child to exit... HILD1: about fork and show a long list of directory contents: otal 32 rwxrWXrNX 1 tux tux 2e59 Feb 2e e8:35 -1-Processes-Creation-Exec-LS MORE G++ Hello . cpp rwxrwxrwx 1 tux tux 13168 Feb 28 88:35 a.out rwxrwxrwx 1 tux tux 267 Feb 20 08:22 hello.cpp rwxrwxrwx 1 tux tux 8816 Feb 2 88:34 hello.out HILD1: about fork and show hello.cpp contents: tinclude using namespace std; int main int argc, char* argv )I if( argc != 2 ) cout using namespace std; int main int argc, char* argv )I if( argc != 2 ) cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!