Question
Q.No.2. Suppose a parent is waiting for the termination of its child. How can it get the return status of its child? Consider the digit
Q.No.2.
Suppose a parent is waiting for the termination of its child. How can it get the return status of its child? Consider the digit 2. Suppose 2 represents the value of your last digit. Now write a program that creates as many child processes as the value of x. For each process, you must check whether it is created successfully or not. After creation, each child process will print the message I am child count. (count = 1, 2, 3, x) and then it will terminate normally using exit(). Count value will be used by each child as exit status value while exiting. After termination of child processes, parent process will check the exit status of each child and will display the status value that was used by the child while exiting. For example, parent can display the following statement for each child:
xxxx: My child has been terminated and its termination code was 3. In this example, xxxx is the id of the parent process.
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