Question: Write a multithreaded program (using pthread in Linux) that calculates various statistics values for a list of numbers. (You may use JAVA if you prefer)

Write a multithreaded program (using pthread in Linux) that calculates various statistics values for a list of numbers. (You may use JAVA if you prefer) This program will be passed a series of numbers on the command line and will then create two separate worker threads. One thread will determine the sum of the numbers, the second will determine the product of the numbers of the input. Alternatively, you may create an array of numbers in your program instead of getting input from users. This method may be simpler to implement. We focus our effort on thread creation, not programming capabilities.

For example, suppose your program is passed the integers 22 7 9 62 8 11 3 The program will report

The sum value is 122

The product is 22686048

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!