Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming Question. please help me 1. (40%) Implement the program that you wrote for the programming question in the midterm. The original question is

C programming Question. please help me

1. (40%) Implement the program that you wrote for the programming question in the midterm. The original question is below. The following additional restrictions are to be implemented. The 2 threads must be running concurrently (at the same time). The sum must be calculated as each number is input. The number of inputs must not be artificially limited. Any negative integer can be used as a sentinel value (Not a specific value e.g. -1). The program must not use busy/wait. The program must not have a race condition. The program must use shared memory or message passing for communication between threads. Original question Write a program that utilises 2 threads. a. One thread accepts user input, a series of positive integers. A negative integer is to be used as a sentinel value to exit. b. The second thread will sum the numbers as they are input, and on receipt of a sentinel value print the sum, and exit. For example: Input a number: 20 Input a number: 10 Input a number: -I The sum is 30

Step by Step Solution

3.42 Rating (146 Votes )

There are 3 Steps involved in it

Step: 1

To determine To create a C program that adds the given positive input numbers an... 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_2

Step: 3

blur-text-image_3

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

Taxation Of Individuals And Business Entities 2015

Authors: Brian Spilker, Benjamin Ayers, John Robinson, Edmund Outslay, Ronald Worsham, John Barrick, Connie Weaver

6th Edition

978-1259206955, 1259206955, 77862368, 978-0077862367

More Books

Students also viewed these Programming questions

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago