subject

Develop a proc_manager program that reads in the commands to execute from an input file one-by-one. You will read one command and its parameters per each line. Then the proc_manager program will start up the process and "babysit" it. You will run each command in a child process using exec and the parent process will wait for each exec to complete. For each child process there will be log messages written to output and error files, which are named after its index in the sequence of commands read in. For example, process #1 will have logs written to 1.out and 1.err. Upon start, the string "Starting command INDEX: child PID pid of parent PPID" will be logged to the corresponding output file 1.out. You can retrieve PID and PPID through the return value of fork() or getpid() or getppid(). You can use dup2() to make filehandle 1 (stdout) go to a file X. out and handle 2 (stderr) go to a file X. err. Note: new executions of a command should append to the previous output and error files, such as 1.out, rather than overwrite them. Upon finish of an exec, the process should record the finish runtime, and it should write to the output file the string "Finished at FIN, runtime duration DUR" where FIN is the finish time and DUR is the duration of the execution. Each time a process finishes, the message "Exited with exitcode = X" should be written to the error file of the process. X is the process exit code. If the process was killed with a signal, then "Killed with signal S" should be written to the error file. S is the signal number that killed the process. This information is gathered using the status parameter of the wait() system call. Here is an example run: ./proc_manager cmdfileWhere cmdfile contains:prompt> cat cmdfilesleep 5ls -latrsleep 3pwdsleep 1wc /etc/passwdall processes shouls run in parallel

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
Ryan is working on the layout of her web page. she needs to figure out where her header, navigation bar, text, and images should go. what technique can her?
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
Now, open this passage to read about fafsa requirements. describe the information you will need to provide in order to complete a fafsa. list at least three of the required documents you must include.
Answers: 3
question
Computers and Technology, 23.06.2019 20:10
Leo is a recruitment executive for a large company. he has identified new labor resource requirements in both the marketing and production departments. what should be his first step in recruiting candidates for the positions? a. conduct background checks of candidates b. make job offers c. arrange interviews d. conduct reference checks e. place job ads on job sites
Answers: 1
question
Computers and Technology, 23.06.2019 23:00
Lucas put a lot of thought into the design for his company's new white paper. he made sure to include repeating design elements such as color schemes and decorative images. his goal was to a.add symmetry b.create a unified publication c.provide consistency d.save money
Answers: 1
You know the right answer?
Develop a proc_manager program that reads in the commands to execute from an input file one-by-one....
Questions
Questions on the website: 13722361