Question: On the Linux system, write and run a C program that will: fork into two processes: the parent will wait for the child to finish

On the Linux system, write and run a C program that will:

fork into two processes: the parent will wait for the child to finish and print We are all done. The child will execute the ls command to print out a list of the files in the directory.

You may use any editor ed, vi, pico, emacs to create your program (save the file as filename.c, where filename is any name you choose). To compile use the c compiler (gcc) on your program:

gcc filename.c

The result of the compilation, assuming no errors, is a file a.out. Since your directory is not in the default path, you run the program as:

./a.out

Thats a period, followed by a slash, followed by a.out.

Submit: the name of your source file (filename.c) and the path to the directory it is in, which should be your account name (that is you default directory) and maybe a subdirectory, if you created one. I will read (maybe compile) and run your program.

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!