Write a multithreaded program

Assignment Help Basic Computer Science
Reference no: EM13220006

Write a multithreaded program (using pthread in Linux) that calculates various statistics values for a list of numbers.

This program will be passed a series of numbers on the command line and will then create three separate worker threads. One thread will determine the average of the numbers, the second will determine the maximum value, and the third will determine the minimum value.

The variables representing the average, minimum, and maximum values will be stored globally. The worker threads will set these values, and the parent thread will output the values one the workers have exited. Make sure it is able to compile a program prog.c with pthread, do "gcc -lpthread -o prog prog.c"

Need the: a) The code b) Screenshot of the terminal showing your program running with at least 8 (different) numbers as run-time input

For example, suppose your program is passed the integers 90 81 78 95 79 72 85 The program will report The average value is 82 The minimum value is 72 The maximum value is 95

 

Reference no: EM13220006

Questions Cloud

What are some ways that company''s can use to get the word : Security awareness programs are their so employees cannot make ignorance an excuse. What are some ways that company's can use to get the word out, and to make sure their employees cannot make that excuse?
Why do we often see government revenues change : Do you believe in the idea that governments should run surpluses in good years only to spend their way out of a recession in bad years Why do we often see government revenues and spending change when we are in a recession.
Why an organization prefer one approach over the other : As a system analyst, which would you prefer? Why? Can the two approaches be successfully combined? Explain. In all cases, support your analysis with specific examples from your readings, research, and professional experience (if applicable).
How does the translate into a greater than impact on economy : If the marginal propensity to consume for an economy as a whole is 0.75, what is the simple multiplier equal to? If governments spend 1 billion dollars, how does this translate into a greater than a $1 billion impact on the economy.
Write a multithreaded program : This program will be passed a series of numbers on the command line and will then create three separate worker threads. One thread will determine the average of the numbers, the second will determine the maximum value, and the third will determine..
Which makes end result much larger than initial expenditure : Government spending is often too small to have the impact that governments usually want to see on the economy. However, something occurs in the economy after the initial government injection which makes the end result much larger.
Write a sql query to display customer id : Use joining technique (WHERE commands is preferred[1]) to write a SQL query to display customer ID, customer name, and customer address for all the customers who are doing business with PVFC in the territory of Southwest.
Consider a variant of cbc-mode encryption : Consider a variant of CBC-mode encryption where the sender simply increments the IV by 1 each time a message is encrypted (rather than choosing IV at random each time). Show that the resulting scheme is not CPA-secure.
What is the required rate of return on the great danes stock : Great Dane, a Danish firm, has systematic risk of 0.9 when measured against the MSCI World Market Index. Its systematic risk is 1.25 when measured against the Danish stock index. The expected returns on the MSCI world index.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Explain traffic control devices to alert drivers

Are all intersections located safely with respect to horizontal and vertical alignment? Where intersections happen at end of high-speed environments (e.g., at approaches to towns); are there traffic control devices to alert drivers?

  Given a coin such that the probability of observing heads

given a coin such that the probability of observing heads is ph=.4 and the probability of tails is pt=.6 compute the probability of observing 3 heads after 7 tosses.

  Cyclic codes using generator to compute frame check sequence

This question associates to cyclic codes using generator G(X) = X4 + X2 + 1. For following two messages compute Frame Check Sequence. M1 = 00000001, and M2 = 100000. Skecth shift register circuit.

  Explaining mandatory access control implementation

How are Novell AppArmor and the Red Hat "targeted" SELinux policy similar? Is either a true Mandatory Access Control implementation. If not, explain why.

  Create a class to represent a triangle by storing

Create a class to represent a triangle by storing the lengths of its sides. Make the data members private and provide the typical get/set (accessor/mutator) routines associated with your data members.

  Types of pre-created objects that can be used on web sites

Types of pre-created objects that can be used on Web sites. Describe the objects you find and what they are used for. Include links to the sites you used in your research.

  What are ids and ips

Write a 2-3 page paper that fully answers the questions.

  Calculate and display running total of yesterday receipts

calculate and display the running total of yesterday's receipts. The program should use the method calculate-Charges to determine the charge for each customer.

  Create table-balance on loan at end of month-visual basic

Using Visual basic a tv set is bought with the loan of 563 to be paid off with five monthly payments of 116 interest is 1% per month.

  Write a c++ code that includes the following operations

Write a C++ code that includes the following operations: z=x * y z=z + 5.0 x, y, and z are floating point variables. A function (subroutine) named GetData should be declared to get data (x and y) from keyboard. The call by reference mechanism shou..

  Illustrate the structure of the program?

The scoring instrument has a section on style. These are the four criteria for style: o Do identifiers logically describe use? o Is indentation used correctly to illustrate the structure of the program? o Is there a consistent naming convention? o Do..

  Explain finding a feasible assignment as a shortest path

We say that a course assignment is a feasible assignment if every faculty member teaches either their first or second choice course. Formulate the problem of finding a feasible assignment as a shortest path, max flow, or min-cost flow problem.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd