r/programminghomework • u/hanzomain259 • Feb 16 '18
Implement a Producer/Consumer program (C/C++)
Implement a Producer/Consumer program from Chapter 5. Insert functionality to test how long it takes the producer to insert a new item and the consumer to remove one. Collect a minimum of 10,000 times for each of the producer/consumer pairs. In addition, keep track of how many items are in the shared region when the producer adds or the consumer removes.
1
Upvotes
View all comments
Show parent comment
1
u/thediabloman Feb 20 '18
Histograms are not too difficult. Basically if you have 10,000 items that are a number from 0-99, a histogram of that will be a summation of the frequency of each item. So if you have an exact division of each case then each case will happen 10,000/100 times (10 times). Of course with random numbers you will never have an even divison so this is why you use a histogram.