Answered step by step
Verified Expert Solution
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started