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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:00
Your business be in google top rank.more the rank more the business leads.for best seo and digital marketing services be confident to contact you can get best seo solutions by assistance experts provide digital marketing, website development, seo expert services and social media internet seo expert services your branding solutions. seo expert services ,best seo expert services,online seo expert services,
Answers: 3
question
Computers and Technology, 23.06.2019 15:30
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a.edit the sizes and other characteristics of photos that have been inserted. b.take a screenshot of an image and copy it to the clipboard for pasting. c.search for drawings or other images from a library of prepared pictures. d.make illustrations using lines and shapes that are easy to manipulate.
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
If you combine two cells into one, what action are you performing? a.  adding a new row or column      b.  splitting the cells      c.  removing a new row or column      d.  merging the cells
Answers: 2
You know the right answer?
Implement a solution to the producer consumer problem with the following settings (write c++ code):...
Questions
Questions on the website: 13722361