Question
Requires Linux P1.c program #include #include #include int main (int argc, char *argv[]) { int printChar; if (argc != 2) { fprintf(stderr, usage: %s character
Requires Linux
P1.c program
#include
int main (int argc, char *argv[]) { int printChar;
if (argc != 2) { fprintf(stderr, "usage: %s character ", argv[0]); exit(1); }
printChar = argv[1][0]; int i = 1;
while (i
return 0; }
1. Send your SECOND P1 a Continue signal (SIGCONT) from the keyboard by using the fg command (foreground) with the appropriate job_number, as in the following, assuming 4 is the job_number (use your own job_number, which you can see with the jobs command.): > fg %4 Now you should have the second P1 in the foreground, and the first P1 stopped. Now terminate both processes (using as many steps as you need to). What commands did you use to terminate them?
2. Open a second shell window. FROM THIS SECOND WINDOW, use the -u option with the ps command to obtain both your P1 process_ids. FROM YOUR SECOND SHELL WINDOW, terminate both your P1 processes by sending them each a SIGINT signal. What commands did you use?
3. Briefly describe the difference between SIGINT and SIGKILL (try google or man -7 signal in bash shell).
4. In question 1 above, the fg command was used to make a process resume. You could also get the process to resume by sending it the continue signal (SIGCONT), with your own PID, as in: > kill -SIGCONT PID
In the first shell window, run P1 with appropriate argument. In the second window, use ps to obtain the process_id of P1. FROM THE SECOND SHELL WINDOW: stop P1 continue (resume) P1 stop P1 continue (resume) P1 terminate P1 What commands did you use?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started