操作系统第2章-习题.ppt

上传人:牧羊曲112 文档编号:6472751 上传时间:2023-11-03 格式:PPT 页数:8 大小:370KB
返回 下载 相关 举报
操作系统第2章-习题.ppt_第1页
第1页 / 共8页
操作系统第2章-习题.ppt_第2页
第2页 / 共8页
操作系统第2章-习题.ppt_第3页
第3页 / 共8页
操作系统第2章-习题.ppt_第4页
第4页 / 共8页
操作系统第2章-习题.ppt_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《操作系统第2章-习题.ppt》由会员分享,可在线阅读,更多相关《操作系统第2章-习题.ppt(8页珍藏版)》请在三一办公上搜索。

1、2.试画出下面四条语句的前趋图:S1:a:=x+y S2:b:=z+1 S3:c:=a-b S4:w:=c+1,图 2-2题 四条语句的前趋关系,26.试修改下面生产者消费者问题解法中的错误:,Var mutex,empty,full:semaphore:=1,n,0;buffer:array0,n-1 of item;in,out:integer:=0,0;begin parbegin producer:begin repeat producer an item nextp;wait(mutex);wait(empty);wait(full);wait(mutex);buffer(in):=

2、nextp;in:=in+1 mod n;signal(mutex);signal(full);until false;end,consumer:begin repeat wait(mutex);wait(full);wait(empty);wait(mutex);nextc:=buffer(out);out:=(out+1);out:=(out+1)mod n;signal(mutex);signal(empty);consumer the item in nextc;until false;end parend end,Var mutex,empty,full:semaphore:=1,n

3、,0;buffer:array0,n-1 of item;in,out:integer:=0,0;begin parbegin producer:begin repeat producer an item nextp;wait(empty);wait(mutex);buffer(in):=nextp;in:=(in+1)mod n;signal(mutex);signal(full);until false;end,consumer:begin repeat wait(full);wait(mutex);nextc:=buffer(out);out:=(out+1)mod n;signal(mutex);signal(empty);consumer the item in nextc;until false;end parend end,27 哲学家进餐问题,1.Var chopstick:array0,4 of semaphore;,

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号