b04902xxx 板


LINE

※ [本文转录自 NTU-Exam 看板 #1LgXXQkA ] 作者: rod24574575 (天然呆) 看板: NTU-Exam 标题: [试题] 103下 郭大维 作业系统 期末考+解答 时间: Sat Jul 18 17:11:51 2015 课程名称︰作业系统 课程性质︰必修 课程教师:郭大维 开课学院:电资学院 开课系所︰资工系 考试日期(年月日)︰2015.06.24 考试时限(分钟)︰ 试题 : Operating Systems Final Exam Spring 2015 The exam is 150 minutes long. The total score is 102pts. Please read the questions carefully. 1. Terminologies (18pts). a. Starvation Ans: A process wait infinitely without receiving its requested resource! b. TLB Reach (Hint: Translation Look-aside Buffers is TLB) Ans: The address space that is covered by the TLB. c. Paged Segmentation (Hint: IA-32 Segmentation) Ans: Divide segments further into pages. That is, having Paging for each segment. d. Slab Allocation (Hint: Kernel Memory Allocation) Ans: The memory is partitioned into slabs, that are physically contiguous pages and contain objects. A cache is of one or more slabs. When an object is requested, it is allocated from a slab. e. Working Set Ans: The working set is an approximation of locality. f. Soft Link Ans: It is implemented as a file that contains a pathname. 2. There are 4 necessary conditions for deadlocks. Which necessary condition is to fail if we request every process to acquire all of its needed resources before it starts execution? Which necessary condition is to fail if every resource in a system is sharable at any time? (Hint: Deadlock Prevention) (8pts) Ans: (a) Hold and Wait (b) Mutual Exclusion. 3. Given the following snapshot of the system: Please determine whether the system is safe? If it is safe, you must show me one safe sequence. If not, show me that there is no safe sequence. (5pts) ┌─┬──────┬──────┬──────┐ │ │ Allocation │ Max │ Available │ │ │ A B C D │ A B C D │ A B C D │ ├─┼──────┼──────┼──────┤ │P0│ 1 2 0 1 │ 2 2 1 2 │ 0 1 1 1 │ ├─┼──────┼──────┼──────┤ │P1│ 1 0 0 2 │ 2 0 1 2 │ │ ├─┼──────┼──────┼──────┤ │P2│ 2 1 0 1 │ 2 2 1 2 │ │ ├─┼──────┼──────┼──────┤ │P3│ 2 0 1 1 │ 3 1 1 1 │ │ └─┴──────┴──────┴──────┘ Ans: Yes, there is a sequence <P2, P0, P1, P3>. 4. Address binding time could be at the compile time, loading time, or execution time. What is the address binding time for "Paging"? Will there be any external fragment for "Paging"? You must provide explanation to receive any points. (8pts) Ans: (a) execution time. (b) No external fragment because every process is partitioned into a number of pages to fit in frames of the physical memory. 5. Given the following reference string, which reference causes a page fault under the FIFO algorithm. Please also show us which page is replaced when a page replacement occurs? Suppose that we have 3 available frames, which are empty initially. (5pts) 1 2 3 2 1 5 0 2 3 0 1 4 5 Ans: ┌────────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │Reference String│1│2│3│2│1│5│0│2│3│0│1│4│5│ └────────┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ ┌────────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │ Frame #1 │1│1│1│ │ │5│5│5│3│ │3│3│5│ ├────────┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │ Frame #2 │ │2│2│ │ │2│0│0│0│ │1│1│1│ ├────────┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤ │ Frame #3 │ │ │3│ │ │3│3│2│2│ │2│4│4│ └────────┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ ┌────────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │ Page │ │ │ │ │ │1│2│3│5│ │0│2│3│ │ Replacement │ │ │ │ │ │↓│↓│↓│↓│ │↓│↓│↓│ │ │ │ │ │ │ │5│0│2│3│ │1│4│5│ └────────┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ 6. Please answer these questions for memory management. You must provide explanation to receive any credits. (20pts) a. Please compare "Paging" and "Segmentation" in terms of address translation. Please also give me one advantage and one disadvantage of Segmentation, compared to Paging. (10pts) b. What is the motivation in having an Inverted Page Table? (5pts) c. What is the minimum number of frames to execute an instruction ADD (A), (B), (C)? Note (X) is an indirect address. (5pts) Ans: (a) Paging: Page # + Offset; Segmentation: Segment # + Offset. For Address Translation, Segmentation must compare the offset with the segment size, and add the segment base address and the offset for the physical address, where Paging just replace the Page # with the Frame #. Segmentation Advantage: Logic unit per segment, disadvantage: external fragmentation (B) A page table tends to be big and does not correspond to the # of pages residing in the physical memory. We just keep one inverted page table for all processes in the system. (C) 7 frames 7. The performance of Demand Paging could be improved by reducing the page fault probability or the page fault service time. Does Page Buffering helps in reducing the page fault probability or the page fault service time? Do we reduce the page fault probability or the page fault service time if the system gives more frames to a process? You must provide explanation to receive any credits. (10pts) Ans: (a) the page fault service time because the system keeps a pool of free frames to page in needed pages asap. (b) the page fault probability because a reasonable page replacement algorithm will have less page faults. 8. The Second-Chance Algorithm is an LRU approximation algorithm. Please explain why the Second-Chance Algorithm could select the LRU page? (Or explain why recently or actively used pages will not be selected for page replacement.) (8pts) Ans: Actively used pages will often have their reference bits set by MMU so that the Second-Chance Algorithm will always skip them in victim page selection. 9. Please use Table of Open Files (per Process) and the System Open File Table to explain when a parent process and a child process can access the same file with the same file offset pointer. (5pts) Ans: It is because the Table of Open Files of the child process is copied from its parent process such that each corresponding entries points to the same one in the System Open File Table. 10. Given an x86-64 computer system with a 48-bit virtual address, let the system be only byte-addressable. Assume that every page is of 2KB with 8 bytes per page entry in the page table. Suppose that the frame number needs 7 bytes to store. Please answer the following questions: (21pts). a. What would be the maximum number of pages owned by a process? What is the number of frames owned by a process? (6pts) b. Suppose that we have multi-level paging. How many levels do we have in multi-level paging? (5pts) c. Suppose that TLB is adopted for paging, where the above multi-level paging is used. Let the memory access time and TLB access time be 100ns and 10ns, respectively. When the TLB hit ratio is 99%, what is the effective memory access time? (5pts) d. Suppose that demand paging is adopted. Let p be the probability of a page fault, and ma be set as 110ns for the memory access time. pft is the page fault time. When pft is 10ms, what is the probability of a page fault so that the effective access time will not be over 120ns. Note that 1ms = 10^(-3)s, 1ns = 10^(-9)s. (5pts) Ans: a. 2^37 pages; 2^37 frames b. 5 levels c. EMAT = (1 - 0.01) * 610 + 0.01 * 110, unit=ns. d. Solve p for 120 >= (1 - p) * 110 + p * pft --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.231.11.120
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/NTU-Exam/M.1437210714.A.B8A.html
1F:→ rod24574575 : 已收资讯系! 07/18 17:13



※ 发信站: 批踢踢实业坊(ptt.cc)
※ 转录者: w4a2y4 (140.112.16.131), 06/16/2017 20:26:34 ※ 编辑: w4a2y4 (140.112.16.131), 06/21/2017 08:44:28







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:BuyTogether站内搜寻

TOP