Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C program language 1. Triplet Prodigies: Write a C program called lastname Triplets that accepts any number of integers. The program (parent process =P)

image

In C program language

1. Triplet Prodigies: Write a C program called lastname Triplets that accepts any number of integers. The program (parent process =P) should create 3 children, C1, C2, and C3, sequentially. C1 prints its PID, then computes the sum of the user input. C2 prints its PID, then computes the product of the user input. C3 prints its PID, then computes the sum of the squares of the user input. The parent should wait for all three children to complete their calculations before printing its own PID and exiting. BE CAREFUL! Only the parent process should create children. The figure below has examples of running the Triplets program. Lab 07 Note: All labs are due before next week's lab starts CIS 370 PetraAW:Lab_07$ ./P1 1 2 4 Child 1 (pid:108) Result: 7 Child 2 (pid:109) Result: 8 Child 3 (pid:110) Result: 21 All children are done PetraAW:Lab_07$ ./P1 1 2 3 4 5 6 7 8 9 10 Child 1 (pid:112) Result: 55 Child 2 (pid:113) Result: 3628800 Child 3 (pid:114) Result: 385 All children are done PetraAW:Lab_07$ The order of events in your program should look as follows: 1. Parent process P creates child process C1 and waits. 2. C1 computes sum, prints result and exits. 3. P creates child C2 and waits. 4. C2 computes product, prints result and exits. 5. P creates child C3 and waits. 6. C3 computes sum of squares, prints result and exits. 7. P prints its message and exits. Due: Week of 10/28/2019

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions