




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年秋新北师大版数学一年级上册教学课件 第一单元 生活中的数 第7课时 快乐的午餐
- 水质实验室基础知识培训课件
- 新型储能项目安全生产方案
- 聚酰亚胺薄膜生产线项目运营管理手册
- 施工现场卫生管理方案
- 化工产业园危险化学品应急响应方案
- 一、机械能(第2课时) -苏科版九年级《物理》上册考点练习
- 影视艺术特性74课件
- 水电消防知识培训课件
- 2025版建筑工程设计与施工一体化论文集合同
- 锂离子电池正极材料研究进展
- 二手房屋买卖物品交接清单
- 技师论文 变频器的维修与保养
- 非标自动化设备项目进度表
- 诊断学教学胸部查体
- 桥梁安全事故案例警示
- YY/T 1095-2015肌电生物反馈仪
- SB/T 10460-2008商用电开水器
- GB/T 9124.1-2019钢制管法兰第1部分:PN系列
- GA 1800.2-2021电力系统治安反恐防范要求第2部分:火力发电企业
- 欣旺集团种禽养殖管理制度手册
评论
0/150
提交评论