信号量与PV操作题稿.pptVIP

  • 24
  • 0
  • 约7.71千字
  • 约 32页
  • 2017-03-08 发布于湖北
  • 举报
item B[k]; semaphore empty; empty=k; //可以使用的空缓冲区数 semaphore full; full=0; //缓冲区内可以使用的产品数 int in=0; //放入缓冲区指针 int out=0; //取出缓冲区指针? cobegin process producer ( ){ while(true) { produce( ); P(empty); append to B[in]; in=(in+1)%k; V(full); } } coend ? * process consumer ( ){ while(true) {

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档