- 20
- 0
- 约3.67千字
- 约 4页
- 2017-12-20 发布于河南
- 举报
信号量练习2
1. Please fill the blanks in the following program (the producer-consumer problem) with DOWN and UP operation: Two processes share a common, fixed-size buffer. One of them, the producer process puts information into the buffer, and the other one, the consumer process, take it out. The buffer has N slots into which the producer can puts information. You should also give the initial values of mutex and full.
# define N 100 //number of slots in the buffer
typedef int semaphore; //semaphores are a special kind of int
semaphore mutex= ; //controls access to critical region
semaphore empty= N; //
原创力文档

文档评论(0)