操作系统第七次作业

第七次作业

问题一:Explain the difference between internal and external fragmentation.

内部碎片就是已经被分配出去(能明确指出属于哪个进程)却不能被利用的内存空间;

外部碎片指的是还没有被分配出去(不属于任何进程),但由于太小了无法分配给申请内存空间的新进程的内存空闲区域。

问题二:Given five memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB (in order)? Which algorithm makes the most efficient use of memory?

first-fit:

212KB->500KB 空闲分区288KB

417KB->600KB 空闲分区183KB

112KB->288KB 288KB空闲分区变为176KB

426KB等待

best-fit:

212KB->300KB 空闲分区88KB

417KB->500KB 空闲分区83KB

112KB->200KB 空闲分区88KB

426KB->600KB 空闲分区174KB

worst-fit:

212KB->600KB 空闲分区388KB

417KB->500KB 空闲分区83KB

112KB->388KB 388空闲分区变为276KB

426KB等待

综上,best-fit对内存利用最高效,因为只有best-fit使得所有进程得以运行

问题三:Consider a paging system with the page table stored in memory.

a. If a memory reference takes 200 nanoseconds, how long does a paged memory reference take?

b. If we add TLBs, and 75 percent of all page-table reference are found in the TLBs, what is the effective memory reference time?(Assume that finding a page-table entry in the TLBs takes zero time, if the entry is there)

答:

a:

每一次的数据/指令存取需要两次内存存取,一次是存取页表,一次是存取数据,所以一次分页内存引用需要时间为: 200 n s × 2 = 400 n s 200ns\times 2=400ns 200ns×2=400ns

b:

如果引入TLBs,有效内存引用时间为: 200 n s × 2 × 25 % + 200 n s × 75 % = 250 n s 200ns\times 2 \times 25\%+200ns\times 75 \%=250ns 200ns×2×25%+200ns×75%=250ns

问题四:Consider the following segment table:
SegmentBaseLength
0219600
1230014
290100
31327580
4195296

What are the physical addresses for the following logical addresses?

a. 0,430

b. 1,10

c. 2,500

d. 3,400

e. 4,112

**a:**219+430=649

b:2300+10=2310

c:500>100越界错误

d:1327+400=1727

**e:**112>96越界错误

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值