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
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