经典操作系统附加题答案.pptxVIP

  • 4
  • 0
  • 约1.55千字
  • 约 11页
  • 2020-06-27 发布于湖北
  • 举报
进程同步问题;作业;;精选;精选; semaphore empty=10;// 表示缸中目前还能装多少桶水,初始时能装10桶水 semaphore full=0;// 表示缸中有多少桶水,初始时缸中没有水 semaphore buckets=3;// 表示有多少只空桶可用,初始时有3只桶可用 semaphore mutex_well=1;// 用于实现对井的互斥操作 semaphore mutex_bigjar=1; // 用于实现对缸的互斥操作 ? young_monk() { ???????while(1){ ??????????????P(empty); ??????????????P(buckets); ??????????????go to the well; ??????????????P(mutex_well); ??????????????get water; ??????????????V(mutex_well); ??????????????go to the temple; ??????????????P(mutex_bigjar); ??????????????pure the water into the big jar; ??????????????V(mutex_bigjar); ??????????????V(buckets); ??????????

文档评论(0)

1亿VIP精品文档

相关文档