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
Dr. wisteria is a prominent chiropractor in the chicago area. she wants to provide a forum for her patients to discuss their health concerns and to seek and offer advice to other patients. which telecommunications tool is most appropriate for dr. wisteria's needs?
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
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
question
English, 21.11.2020 04:20
question
Mathematics, 21.11.2020 04:20
question
Mathematics, 21.11.2020 04:20
question
Mathematics, 21.11.2020 04:20
Questions on the website: 13722361