操作系统进程管理习题课件.ppt

上传人:rrsccc 文档编号:11015310 上传时间:2021-06-16 格式:PPT 页数:8 大小:373KB
返回 下载 相关 举报
操作系统进程管理习题课件.ppt_第1页
第1页 / 共8页
操作系统进程管理习题课件.ppt_第2页
第2页 / 共8页
操作系统进程管理习题课件.ppt_第3页
第3页 / 共8页
操作系统进程管理习题课件.ppt_第4页
第4页 / 共8页
操作系统进程管理习题课件.ppt_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《操作系统进程管理习题课件.ppt》由会员分享,可在线阅读,更多相关《操作系统进程管理习题课件.ppt(8页珍藏版)》请在三一文库上搜索。

1、操作系统进程管理习题,1,2. 试画出下面四条语句的前趋图: S1: a:=x+y S2: b:=z+1 S3: c:=a-b S4: w:=c+1,操作系统进程管理习题,2,图 2-2题 四条语句的前趋关系,操作系统进程管理习题,3,26. 试修改下面生产者消费者问题解法中的错误:,操作系统进程管理习题,4,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

2、an item nextp; wait(mutex); wait(empty); wait(full); wait(mutex); buffer(in):=nextp; ; in:=in+1 mod n; signal(mutex); ; signal(full); until false; end,操作系统进程管理习题,5,consumer: begin repeat wait(mutex); wait(full); wait(empty); wait(mutex); nextc:=buffer(out); out:=(out+1); out:=(out+1) mod n; signal(m

3、utex); ; signal(empty); consumer the item in nextc; until false; end parend end,操作系统进程管理习题,6,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(empty); wait(mutex); buffer(in):=nextp; in:

4、=(in+1) mod n; signal(mutex); signal(full); until false; end,操作系统进程管理习题,7,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,操作系统进程管理习题,8,27 哲学家进餐问题,1. Var chopstick: array0, , 4 of semaphore;,

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

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1