Write a c program that creates three processes


Part A: Write a C program ("p1a.c") that creates three processes: a parent process that creates two children processes.

The first child should do the following:
- display "First child is born, my pid is ..."
- display ten times the message "First child executes iteration X", where X is the number of the iteration
- display "First child dies quietly."

The second child should do the following:
- display "Second child is born, my pid is ..."
- display ten times the message "Second child executes iteration X", where X is the number of the iteration
- display "Second child dies quietly."

The parent process should do the following:
- display "Parent process is born, my pid is ..."
- create the first child
- create the second child
- wait for the children to finish their execution (both of them)
- display "Parent process dies quietly."

Compile the program using gcc and name the executable "p1a". Execute the program several times and notice how the output of the two children interlace. All files belonging to this part of the project should be placed in your nova home directory and also posted in Webtycho under the Project 1 assignment.

A possible output of this program is:

nova> ./p1a
Parent process is born, my pid is 7847
First child is born, my pid is 7848
First child executes iteration: 1
First child executes iteration: 2
First child executes iteration: 3
First child executes iteration: 4
First child executes iteration: 5
Second child is born, my pid is 7849
Second child executes iteration 1
Second child executes iteration 2
Second child executes iteration 3
First child executes iteration: 6
Second child executes iteration 4
Second child executes iteration 5
Second child executes iteration 6
First child executes iteration: 7
Second child executes iteration 7
Second child executes iteration 8
Second child executes iteration 9
Second child executes iteration 10
Second child dies quietly.
First child executes iteration: 8
First child executes iteration: 9
First child executes iteration: 10
First child dies quietly.
Parent process dies quietly. 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a c program that creates three processes
Reference No:- TGS0135155

Expected delivery within 24 Hours