4. Write a multithreaded program that calculates various statistical values for a list of numbers. This...

70.2K

Verified Solution

Question

Programming

4. Write a multithreaded program that calculates variousstatistical values for a list of numbers. This program will bepassed a series of numbers on the command line and will then createfive separate worker threads. One thread will determine the averageof the numbers, the second will determine the maximum value, thethird will determine the minimum value, fourth will determine themedian value and the fifth will compute the std. deviation.

For example, suppose your program is passed the integers 90 8178 95 79 72 85

The program will report

The average value is 82.8

The minimum value is 72

The maximum value is 95

The median value is 81

The standard deviation is 7.2

The variables representing the average, minimum, and maximumvalues will be stored globally. The worker threads will set thesevalues, and the parent thread will output the values once theworkers have exited.

Answer & Explanation Solved by verified expert
4.2 Ratings (574 Votes)
Code include include include void avgfuncvoid str void minfuncvoid ptr void maxfuncvoid ptr double avg int min int max typedef struct datastruct int size int    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students