Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
Sample output will look like this:
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: tincludeStep 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