Check out the Unix/Linux commands ps and kill and their various options. a) Use the ps command to get a list of all your processes and save them in a log.txt file. At a minimum, the following 4 attributes should be recorded in the file for each process: name, process ID (PID), memory usage and CPU time. Attach the generated log file as an answer to this question. b) Open a terminal and get the PID of your editor process. Use the kill command to shut down the editor process. In your answer, show the commands you used to achieve the goal and explain what is what for each command. c) Write a C program that will start an editor process, get its PID, wait 3 seconds, and then terminate the editor process (You can use the exec family of system calls (man exec) to start any program or command from within a C program). d) Write a C program that will constantly monitor all processes (let's say once a second) and kill an editor immediately if it encounters an editor.
Check out the Unix/Linux commands ps and kill and their various options.
a) Use the ps command to get a list of all your processes and save them in a log.txt file. At a minimum, the following 4 attributes should be recorded in the file for each process:
name, process ID (PID), memory usage and CPU time.
Attach the generated log file as an answer to this question.
b) Open a terminal and get the PID of your editor process. Use the kill command to shut down the editor process. In your answer, show the commands you used to achieve the goal and explain what is what for each command.
c) Write a C program that will start an editor process, get its PID, wait 3 seconds, and then terminate the editor process (You can use the exec family of system calls (man exec) to start any program or command from within a C program).
d) Write a C program that will constantly monitor all processes (let's say once a second) and kill an editor immediately if it encounters an editor.
Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 3 images