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/m.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燈, 水草

請輸入看板名稱,例如:Tech_Job站內搜尋

TOP