当前位置:首页 > 操作系统教程第5版部分习题(含答案)答案
31、答:
semaphore wait,mutex1,mutex2; mutex1=mutex2=1;wait=1; int counter1,counter2; count1=count2=0; Cobegin {
Process p1 {
P(mutex1); counter1++; if (counter1==1) then P(wait); V(mutex1); 过独木桥; P(mutex1); counter1--;
if (counter1==0) then V(wait); V(mutex1); }
Process p2 {
P(mutex2); Counter2++;
if (counter2==1) then P(wait); V(mutex2); 过独木桥; P(mutex2); counter2--;
if (counter2==0) then V(wait); V(mutex2); } } coend 50、答: 答:semaphore mutex1,mutex2; semaphore empty,full,count;
mutex1=mutex2=1;count=3;empty=10;full=0; cobegin
process youngmonki(i=1,2…) {
While(true){
P(empty);
P(count); P(mutex1); 从井中取水; V(mutex1);
P(mutex2); 倒入水缸; V(mutex2); V(count); V(full); } }
process oldmonki(i=1,2…) {
while(true){
P(full); coend
P(count); P(mutex2); 从缸中取水; V(mutex2); V(count); V(empty); } }
第四章: 一、
1、试述存储管理的基本功能。 答:
(1) 存储分配; (2) 地址映射; (3) 存储保护; (4) 存储共享; (5) 存储扩充。
4、何谓地址转换(重定位)?哪些方法可以实现地址转换? 答: 逻辑地址转换为物理地址的过程称为地址转换(重定位)。 (1) 静态地址重定位; (2) 动态地址重定位; (3) 运行时链接地址重定位。
18、试述实现虚拟存储器的基本原理。有哪几种实现方法? 答:
共分享92篇相关文档