subject

Implement a solution to the producer consumer problem with the following settings (write c++ code):
there are three producers all in infinite while loops each producing 1 item in one loop.
there are three consumers all in infinite while loops each consuming 1 item in one loop.
every consumer or producer yields at the end of a loop to the next process
consider that the buffer size is 6 items.
consider that in your ready queue there are three consumers then seven producers then 7 consumers and finally three more producers .
run the code for infinitely long.
at the end of each loop before yield the consumer should print the following:
if consumer x is consuming an item then print
"this is consumer x consuming item generated by producer y"
else print
"consumer x is waiting"
at the end of each loop before yield the producer should print the following: if producer x is producing an item then print
"this is producing x producing item number y"
else print
"producer x is waiting"

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:10, jasoncarter
3. consider the following class definitions: class smart class supersmart: public smart { { public: public: void print() const; void print() const; void set(int, int); void set(int, int, int); int sum(); int manipulate(); smart(); supersmart(); smart(int, int); supersmart(int, int, int); private: private: int x; int z; int y; int secret(); }; }; . which private members, if any, of smart are public members of supersmart? a. which members, functions, and/or data of the class smart are directly accessible in class supersmart?
Answers: 2
image
Computers and Technology, 23.06.2019 04:31, mona92
Which of the following is not a way in which trees benefit the environment? a. they remove a significant amount of carbon dioxide from the atmosphere. b. they remove a significant amount of oxygen from the atmosphere. c. their roots hold soil in place, reducing rates of erosion. d. they remove ozone and particulates from the atmosphere. select the best answer from the choices provided a b c d
Answers: 1
image
Computers and Technology, 23.06.2019 23:40, lexiecooley
4. what is the reason for including the following code snippet in the header file animal. h? #ifndef animal_h #define animal_h class animal { public: animal(); animal(double new_area_hunt); void birth(); void hunt(double new_area_hunt); void death(); double get_area_hunt() const; private: double area_hunt; }; #endif
Answers: 3
image
Computers and Technology, 24.06.2019 00:40, iamsecond235p318rq
To maintain clarity and focus lighting might be needed
Answers: 2
You know the right answer?
Implement a solution to the producer consumer problem with the following settings (write c++ code):...

Questions in other subjects:

Konu
Biology, 05.02.2021 01:00
Konu
Biology, 05.02.2021 01:00
Konu
English, 05.02.2021 01:00