The Unix system can do several things at once. You will have a chance to use
Question:
The Unix system can “do several things at once”. You will have a chance to use process related system calls such as fork, exec and wait. Using fork you can create new processes to perform different tasks; using fork and exec, you can run several programs at the same time; using wait you can access the exit status of a child process. Task: You are required to write a C program on Unix/Linux in which the parent process creates three child processes, lets them run CONCURRENTLY, and waits for them to return and prints their exit status. The three child processes are assigned different tasks. Child one is to take in the ages of 6 people from the user and calculates and displays the average and the oldest age. Child two is to load an existing unix program called “sort” to sort lines of a file in reverse alphabetic order and display them on the standard output. Child two must retrieve the name of the file to be sorted from the first command line argument (i.e. argv[1]). Child three is to modify a file by first inserting “This is the updated version.” at the beginning of this file and then replacing all the occurrences of the string “table” with “desk”. Child three must retrieve the name of the file to be modified from the second command line argument(i.e. argv[2]). You are required to write your OWN program for the file update. (i.e. the use of existing programs such as sed or similar is not allowed)
1. write a text or doc file ”readme” which contains: (b) How to compile and run your code (c) A simple description of your solution logic or pseudo code (d) your test run and output. (e) the limitations if your program does not output the expected result. 2. Your code should contain necessary comments to explain what the code is accomplishing and how.
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young