Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribed

Sample output will look like this:

image text in transcribed

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

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

More Books

Students also viewed these Databases questions

Question

=+5. What are their resources?

Answered: 1 week ago

Question

Explain basic guidelines for effective multicultural communication.

Answered: 1 week ago

Question

Identify communication barriers and describe ways to remove them.

Answered: 1 week ago

Question

Explain the communication process.

Answered: 1 week ago