Question: 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
To solve this problem we need to create a program in C using threading to meet the given requirement... View full answer
Get step-by-step solutions from verified subject matter experts
