Question: 1. Write a C program where you will use suitable Unix/Linux system calls to create a new child process. The child process will create another

1. Write a C program where you will use suitable Unix/Linux system calls to create a new child process. The child process will create another child process and so on, for a total of 10 times. Each child process will print a line on the screen indicating the child number (this is not the child pid, but an integer indicati index number of child process; for example, the 8th child will print "8th child", and so on), after which it will wait for one sec then exit (with an exit value of the child number). Each parent will wait for its child to exit, then collect the exit status of the child (using a suitable system call from the wait fa system calls), and print it out to the screen (using a printf statement saying something like "child with pid .... exited with retu with return status ...."). The topmost parent will add an extra printf statement indicating that it is the grandparent of all the children. 2. Write a C program to use the signal related system calls to setup a signal that triggers every time the user presses the Co key. Also write a corresponding signal handler that prints "Control+c pressed .... times so far" (where the .... is to be filled up with integer value indicating how many times Control+c has been pressed so far). When the count reaches 10 times, the handler will print "This is the last time. Bye" and will exit the program. the main function, after the signal handler has been set up, the program should run a loop where the program prints":-) every second repeatedly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
