subject

In this lab you will simulate simple multithreading application with producer and consumer" problem Modify "Producer and Consumer Problem" from lecture note so that it can use all buffer space, not "buffe_size - 1" as in the lecture note. This program should work as follows: 1. The user will run the program and will enter two numbers on the command line. Those numbers will be used for buffer size and counter limit.
2. The main program will then create two separate threads, producer and consumer thread.
3. Producer thread generates a random number through random number generator function and inserts this into buffer and prints the number. Increment counter.
4. Consumer thread goes to the buffer and takes a number in the proper order and prints it out. Increment counter.
5. After counter reaches its limit, both threads should be terminated and return to main.
6. Main program terminates. You can implement this project in any OS environment of your choice, windows, Linux, etc. Also, you can use any programming languages you want but your program and sample run should clearly show implementation of subtasks through separate threads.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print?
Answers: 3
question
Computers and Technology, 22.06.2019 13:00
We as humans write math expression in infix notation, e.g. 5 + 2 (the operators are written in-between the operands). in a computer’s language, however, it is preferred to have the operators on the right side of the operands, i.e. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix.write a program that takes an “infix” expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % (example infix expression: (7 - 3) / (2 + 2)postfix expression: 7 3 - 2 2 + /result: 1guidelines: 1. you will need to use stacks in three placesa. one for the parenthesis check [char stack]b. one during infix to postfix [char stack]c. one during evaluation [int stack]for a and b above, you can use same array and same push, pop method as both ofthem are char. but for evaluation you have int stack and you might consider to createanother push pop method to handle it. maybe push_int, pop_int, etc. or find otherstrategy to utilize existing push pop method2. you can create a function for obtaining operator priority. that function should take anoperator as input and return its priority as an integer. this function will you a lot andreduce repeated code3. during evaluation you will need to convert char into integer. example for single digit: char c = '5'; int x = c - '0';
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
Nathan wants to create multiple worksheet containing common formatting styles for his team members. which file extension him to save these worksheets? nathan to create multiple worksheets with common styles. he needs to save them with the extension.
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
You know the right answer?
In this lab you will simulate simple multithreading application with producer and consumer" problem...
Questions
question
English, 27.05.2021 17:10
question
English, 27.05.2021 17:10
question
History, 27.05.2021 17:10
question
Mathematics, 27.05.2021 17:10
question
Mathematics, 27.05.2021 17:10
question
History, 27.05.2021 17:10
question
Mathematics, 27.05.2021 17:10
question
Mathematics, 27.05.2021 17:10
Questions on the website: 13722360