Question: Please write a program in C, there needs to be two for-loops. Every UNIX process is guaranteed to have a unique numeric identifier called the

 Please write a program in C, there needs to be two

Please write a program in C, there needs to be two for-loops.

Every UNIX process is guaranteed to have a unique numeric identifier called the process ID. The process ID or PID is always a nonnegative integer. The only way under UNIX (with a few exceptions) to create a new process is when an existing process calls the fork function. You can find details about fork and wait in the manual pages (man fork) The ideal solution is composed of a single parent process which simultaneously opens up multiple child processes which performs their function once and then quits. Code to close up the child processes should be at the end of the program Also introduced in this lab are command-line options for UNIX programs. By convention, your program should start with the following two variables: int main(int arge, char argv //arge is an integer of the number of arguments //argv "argument vector" is a character array of the arguments Write a simple program that uses the fork function. Sample code: man wait& man getpid Program requirements: 1. The program should take either filenames or wildcards (for example) as input 2. Create as many child processes as there are files on the command line. Child processes should run simultaneously, not wait on each other. There are MANY ways that your code r sequential processing. To test for parallel code, make your child process wait for 1 second. If you have n files and your program is delayed 1 second, your code is parallel. If it is delayed n seconds, it is not parallel not wait on each other. There are MANY ways that your code may be liited to 3. For each child process, print the file name and the process ID of the child proces 4. The parent process should wait for all the children to finish then show the output from: system(ps omand to debug r): This statement placed in other locations of your program may be a helpfulo your code 5% Extra Credit: instead of Canvas, submit your assignment via https (MUST be private, invite swirsz) I will use Github's last modified date as the submission date. Make sure to put your full name in the header of your file if you submit it by Github. ://education.github.com/

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!