Question: Write a C / C + + programming that does the following: a . Create a new process child 1 b . The parent (

Write a C/C++ programming that does the following:
a. Create a new process child1
b. The parent (of child1) should print its id and wait for the termination of the child1
process
c. The child1 process should call a function that subtracts two numbers passed as
arguments and print the result on the console screen along with the pid of the process
that is printing
d. The child1 process should create a new child process (child2)
e. The child2 process should call a function that adds two numbers passed as
arguments and print the result along with its pid while child1 waits
f. Control should then come back to the first child process child1 that now should call a
function that multiplies two numbers passed as arguments and print the result and pid
of the printing process to the console and then terminate
g. The waiting parent process should now resume and terminate the program
h. Note: arguments to functions may be hard coded or taken in as user input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!