Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write the code in c++ Create two applications that will calculate basic statistics about a collection of data using multiple process and multiple threads

please write the code in c++ image text in transcribed
Create two applications that will calculate basic statistics about a collection of data using multiple process and multiple threads respectively. The master thread/parent process should read the data from a file and then spawn the child threads/child processes to process the data. Example: gbarlas@kinpenguin: $./statFork 4 data.txt Min: 10 Max: 1253 Average: 128.64 should generate four child processes (so five in total) to process the data. A similar convention of calling should be done for the multi-threaded program. E.g. gbarlas@kinpenguin: $./statThread 4 data.txt Min: 10 The data file should be a text file that has a number per line and starts with the total number of data items in the first line. E.g.: 1000 346.4 7798.2 ... // 998 more lines follow Use pipelines to allow the parent process collection of the partial results from the children. In the case of threads, shared data can be utilized. Once you complete and test your code, test and compare the performance of the two programs for different number of child processes and threads, i.e. find the execution times and calculate the speedup (the parent should be also computing part of the result). A graph showing your results for 2, 4, 6 and 8 processes/threads should be provided. Create two applications that will calculate basic statistics about a collection of data using multiple process and multiple threads respectively. The master thread/parent process should read the data from a file and then spawn the child threads/child processes to process the data. Example: gbarlas@kinpenguin: $./statFork 4 data.txt Min: 10 Max: 1253 Average: 128.64 should generate four child processes (so five in total) to process the data. A similar convention of calling should be done for the multi-threaded program. E.g. gbarlas@kinpenguin: $./statThread 4 data.txt Min: 10 The data file should be a text file that has a number per line and starts with the total number of data items in the first line. E.g.: 1000 346.4 7798.2 ... // 998 more lines follow Use pipelines to allow the parent process collection of the partial results from the children. In the case of threads, shared data can be utilized. Once you complete and test your code, test and compare the performance of the two programs for different number of child processes and threads, i.e. find the execution times and calculate the speedup (the parent should be also computing part of the result). A graph showing your results for 2, 4, 6 and 8 processes/threads should be provided

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

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions