Question
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
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-1843 then the last non-zero digit is 3. 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.
roll 17-arid-1843
Q.No.2. (08) 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. Q.No.2. (08) 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 processStep 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