




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Page 1 10 University of California Berkeley College of Engineering Computer Science Division EECS Spring 2012 Anthony D Joseph and Ion Stoica Midterm Exam March 7 2012 CS162 Operating Systems Your Name SID AND 162 Login TA Name Discussion Section Time General Information This is a closed book and one 2 sided handwritten note examination You have 80 minutes to answer as many questions as possible The number in parentheses at the beginning of each question indicates the number of points for that question You should read all of the questions before starting the exam as some of the questions are substantially more time consuming Write all of your answers directly on this paper Make your answers as concise as possible If there is something in a question that you believe is open to interpretation then please ask us about it Good Luck QUESTION POINTS ASSIGNED POINTS OBTAINED 1 20 2 20 3 15 4 20 5 15 6 10 TOTAL 100 CS 162 Spring 2012 Midterm Exam March 7 2012 Page 2 10 1 20 points total Short answer questions a 8 points True False and Why CIRCLE YOUR ANSWER i A lightweight process with one thread is equivalent to a heavyweight process TRUE FALSE Why ii Demand paging requires the programmer to take specific action to force the operating system to load a particular virtual memory page TRUE FALSE Why b 8 points Two level Page Tables i Give a two to three sentence description of a two level page table ii Briefly 2 sentences state one advantage AND one disadvantage of two level page tables c 4 points List the four requirements for deadlock CS 162 Spring 2012 Midterm Exam March 7 2012 Page 3 10 2 20 points total Consider the following two functions implementing a producer and consumer by using monitors void send item lock acquire enqueue item printf before signal n dataready signal printf after signal n lock release item get lock acquire while queue isEmpty printf before wait n dataready wait printf after wait n item dequeue lock release a 4 points Use no more than three sentences to contrast Hoare and Mesa monitors b 5 points Assume two threads T1 and T2 as follows T1 T2 send item item get What are the possible outputs if the monitor uses the Hoare implementation CS 162 Spring 2012 Midterm Exam March 7 2012 Page 4 10 c 5 points Repeat question b for a Mesa implementation of the monitor d 6 points Now assume a third thread T3 i e T1 T2 T3 send item item get send item What are the possible outputs if the monitor uses the Hoare implementation Please specify from which thread does an output come by specifying the thread id in front of the output line e g T1 before signal or T2 after wait CS 162 Spring 2012 Midterm Exam March 7 2012 Page 5 10 3 15 points Design tradeoffs 15 points total You ve been hired by Orange Computer to help design a new processor and Orange Pro laptop After choosing the display case and other components you are left with 460 to spend on the following components Item Latency Minimum Size Cost TLB 10 ns 256 entries 0 10 entry Main memory 180 ns 2 GB 10 GB Magnetic Disk 8 ms 8M ns 300 GB 0 10 GB The page size is fixed at 64 KB Assume you want to run up to 20 applications simultaneously Each application has an overall maximum size of 1 GB and a working set size of 256 MB TLB entries do not have Process Identifiers Discuss how you would divide the available funds across the various items to optimize performance CS 162 Spring 2012 Midterm Exam March 7 2012 Page 6 10 4 20 points Concurrency control Consider the following pseudocode that aims to implement a solution for the Dining Philosopher problem Note that a philosopher can use any chopstick assume chopstick i status FREE for 1 i N get chopstick boolean hold one chopstick lock acquire for i 1 i N i if chopstick i status FREE chopstick i status BUSY return i lock release return 1 release chopstick i if i 1 return chopstick i status FREE philosopher plate FULL while plate FULL chopstick1 get chopstick FALSE if chopstick1 1 chopstick2 get chopstick TRUE plate EMPTY release chopstick chopstick2 release chopstick chopstick1 main for i 1 i N i thread fork philosopher a 2 points Name an error in how synchronization primitives are used in get chopstick CS 162 Spring 2012 Midterm Exam March 7 2012 Page 7 10 b 10 points After fixing the error in part a does the program work correctly If it does not give a simple example to show how the program fails and provide a fix If it does use no more than three sentences to argue why it works c 8 points Assume main launches N 1 philosopher threads instead of N Will the program work correctly given the changes you made for parts a and b If it does not give a simple example to show how the program fails and provide a fix If it does use no more than three sentences to argue why it works CS 162 Spring 2012 Midterm Exam March 7 2012 Page 8 10 5 15 points total Scheduling a 15 points Consider the following processes arrival times and CPU processing requirements Process Name Arrival Time Processing Time 1 0 3 2 1 5 3 3 2 4 9 2 For each scheduling algorithm fill in the table with the process that is running on the CPU for timeslice based algorithms assume a 1 unit timeslice For RR and SRTF assume that an arriving thread is run at the beginning of its arrival time if the scheduling policy allows it The turnaround time is defined as the time a process takes to complete after it arrives Time FIFO RR SRTF 0 1 1 1 1 2 3 4 5 6 7 8 9 10 11 Average Turnaround Time CS 162 Spring 2012 Midterm Exam March 7 2012 Page 9 10 6 10 points total Caching Assume a computer system employing a cache where the access time to the main memory is 100 ns and the access time to the cache is 20ns a 2 points Assume the cache hit rate is 95 What is the average access time b 2 points Assume the system implements virtual memory using a two level page table with no TLB and assume the CPU loads a word X from ma
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- DB1410-T 130-2022 园林绿化管养规范
- 项目2 学会养绿萝说课稿-2025-2026学年小学劳动一年级上册湘人版《劳动实践指导手册》
- 2025建筑设备自考试题及答案
- 2025年乡村医生资格考试题库含答案
- 2025年公务员面试真题及答案
- 2025年低压电工证考试题库附答案
- 2025宁阳社工考试题库及答案
- 2025保育学自考试题及答案
- 四级营养师技能考核考试真题及答案(2025年新版)
- 2025年中级经济师题库附参考答案
- 人教部编版九年级历史上册思维导图【版】(24张) 省赛获奖
- 低压电工试题库-含答案
- 【幼儿自主游戏中科学探究活动实践研究文献综述1900字】
- 肝脓肿的诊断和治疗
- YY 9706.102-2021医用电气设备第1-2部分:基本安全和基本性能的通用要求并列标准:电磁兼容要求和试验
- GB 7691-2003涂装作业安全规程安全管理通则
- 危险化学品双重预防机制培训课件
- 跌倒坠床原因分析预防措施
- 湖南人民出版社乘槎笔记(斌椿)
- Q∕SY 1452.1-2012 石油装备产品包装规范 第1部分:钻机和修井机
- 妇产科产前诊断技术服务临床医师考核题(附答案)
评论
0/150
提交评论