Question: The following picture is step (handle from tutorial 9) C programming language 2. Write a program in t10-fork.c which creates a new process in main

 The following picture is step (handle from tutorial 9) C programming The following picture is step (handle from tutorial 9)

language 2. Write a program in t10-fork.c which creates a new process

C programming language

2. Write a program in t10-fork.c which creates a new process in main using the fork system call. Using the return value from fork , print out whether the process is the child or the parent. 3. Add signal handlers to only the child process so that it prints to stdout when it receives SIGUSR1, SIGUSR2, or SIGINT. The child should then wait until receiving SIGINT before terminating. Hint: the child's code should look very similar to the code for handle from Tutorial 9. 4. Add code for (only) the parent process so that it prompts the user to choose which signal to send to the child, then send it. The process should terminate once it has sent a SIGINT to the child process. 1 #incLude 2 #incLude 4 6 int main) 7 int pid, choice; 0 printf("Enter target process number: ") scanf("%d", &pid); 3 while (1) printf("User sig: "); scanf("%d", &choice); if (choice 0) break; else if (choice 1) kill(pid, SIGUSR1); else if (choice- 2) kill(pid, SIGUSR2); L8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!