Question
Assignment 1 Writin a program in which : A parent process creates a child process If the user sends ctrl+c to the parent process before
Assignment 1 Writin a program in which : A parent process creates a child process If the user sends ctrl+c to the parent process before 10 seconds from start, then the parent catches the signal and sends a message to indicate that the system is protected. The child just ignores the signal. Print messages from both parent and child process when they detect ctrl+c signal, both of which should indicate that they cannot be killed yet. Note that the child process must still ignore the ctrl+c signal, so the parent may have to send a different signal to it. After 10 seconds the parent process can now be terminated using ctrl+c, but before the parent terminates it must send a signal to the child and print statements stating it is trying to terminate the child process and has sent a signal. The child then prints its process id with a message saying it receives a signal to terminate from the parent and terminates. The parent then terminates printing a goodbye message. Programming Hints Your parent forks a child. The parent and child both ignores ctrl+c signal After 10 seconds, when ctrl+c is received, the parent process should receive the signal, and send the kill signal to the child. remember child still ignores ctrl+c command maybe you need to send another signal from parent to child. Do you know how to create user defined signals? The child should handle the signal sent from the parent to terminate itself. The parent should terminate itself after the child is terminated.
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