-->
当前位置:首页 > 题库 > 正文内容

单选题:Here is a description of the producer and the consumer in the Pr

Luz3年前 (2021-05-10)题库665
Here is a description of the producer and the consumer in the Producer-Consumer problem@[B](1)
```
Producer process:
item nextProduced;
while (1) {
while (counter == BUFFER_SIZE); /* do nothing */
buffer[in] = nextProduced;
in = (in + 1) % BUFFER_SIZE;
counter ++;
}

Consumer process:
item nextConsumed;
while (1) {
while (counter == 0); /* do nothing */
nextConsumed = buffer[out];
out = (out + 1) % BUFFER_SIZE;
counter --;
}

```
The critical section of the Producer is ______
A. the statement “counter --”
B. the statement “counter ++”
C. the variable “counter”
D. .not exist





A.the statement “counter --”
B.the statement “counter ++”
C.the variable “counter”
D..not exist


答案:B

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。