《操作系统第2章-习题PPT课件》由会员分享,可在线阅读,更多相关《操作系统第2章-习题PPT课件(9页珍藏版)》请在金锄头文库上搜索。
1、 2 试画出下面四条语句的前趋图 S1 a x yS2 b z 1S3 c a bS4 w c 1 图2 2题四条语句的前趋关系 26 试修改下面生产者 消费者问题解法中的错误 Varmutex empty full semaphore 1 n 0 buffer array 0 n 1 ofitem in out integer 0 0 beginparbeginproducer beginrepeat produceranitemnextp wait mutex wait empty wait full wait mutex buffer in nextp in in 1modn signa
2、l mutex signal full untilfalse end consumer beginrepeatwait mutex wait full wait empty wait mutex nextc buffer out out out 1 out out 1 modn signal mutex signal empty consumertheiteminnextc untilfalse endparendend Varmutex empty full semaphore 1 n 0 buffer array 0 n 1 ofitem in out integer 0 0 beginp
3、arbeginproducer beginrepeat produceranitemnextp wait empty wait mutex buffer in nextp in in 1 modn signal mutex signal full untilfalse end consumer beginrepeatwait full wait mutex nextc buffer out out out 1 modn signal mutex signal empty consumertheiteminnextc untilfalse endparendend 27哲学家进餐问题 1 Varchopstick array 0 4 ofsemaphore 感谢亲观看此幻灯片 此课件部分内容来源于网络 如有侵权请及时联系我们删除 谢谢配合