Computers and Technology, 27.03.2020 01:24 evelynontiveros2016
Here are the codes for producer and consumer problems.
Producer:
while (true) {
/* produce an item in next produced */
while (counter == BUFFER_SIZE) ;
/* do nothing */
buffer[in] = next_produced;
in = (in + 1) % BUFFER_SIZE;
counter++;
}
Consumer:
while (true) {
while (counter == 0)
; /* do nothing */
next_consumed = buffer[out];
out = (out + 1) % BUFFER_SIZE; counter--;
/* consume the item in next consumed */
}
counter++ could be implemented by Producer as
register1 = counter
register1 = register1 + 1
counter = register1
counter-- could be implemented by Consumer as
register2 = counter
register2 = register2 - 1
counter = register2
If we set the current value of "counter " as 4, when Producer and Consumer concurrently execute, what are the possible values of ‘’counter", please give an example for each value, point out which value is the right one and analysis the reasons for the wrong values.
Answers: 3
Computers and Technology, 22.06.2019 00:30
Advantages and disadvantages of binary system
Answers: 1
Computers and Technology, 22.06.2019 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
Computers and Technology, 23.06.2019 16:00
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
Computers and Technology, 24.06.2019 09:00
Technician a says that a new replacement part is always good. technician b says that sometimes recent repair work will be the cause of a complaint. who is correct? a. both technicians a and b b. technician a c. technician b d. neither technician a nor b
Answers: 3
Here are the codes for producer and consumer problems.
Producer:
while (true...
Producer:
while (true...
English, 22.04.2021 17:40
Computers and Technology, 22.04.2021 17:40
Mathematics, 22.04.2021 17:40