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
Suppose a parent is waiting for the termination of its child. How can it get the return status of its child? Consider the last non-zero digit of your arid number. For example, if your arid number is “17-arid-840” then the last non-zero digit is 4. Suppose x 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.
Note: This question is from system
Step by step
Solved in 2 steps with 2 images