




已阅读5页,还剩29页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Chapter1 1 Whatarethethreemainpurposesofanoperatingsystem 环境提供者 为计算机用户提供一个环境 使得能够在计算机硬件上方便 高效的执行程序资源分配者 为解决问题按需分配计算机的资源 资源分配需尽可能公平 高效控制程序监控用户程序的执行 防止出错和对计算机的不正当使用管理I O设备的运行和控制 1 1 cont 2 Whatisthemainadvantageofmultiprogramming 高效地使用CPU 通过重叠来自不同用户对CPU和I O设备的需求增加CPU的利用 设法让CPU执行有意义的指令 2 1 cont 3 Inamultiprogrammingandtime sharingenvironment severaluserssharethesystemsimultaneously Thissituationcanresultinvarioussecurityproblems a Whataretwosuchproblems b Canweensurethesamedegreeofsecurityinatime sharedmachineaswehaveinadedicatedmachine Explainyouranswer 用户之间互相偷数据 代码对系统资源使用的记账信息 3 1 cont 4 Definetheessentialpropertiesofthefollowingtypesofoperatingsystems a Batch相似需求的Job分批 成组的在计算机上执行 Job由操作员或自动Job程序装置装载 可以通过采用buffering off lineoperation spooling multiprogramming等技术使CPU和I O不停忙来提高性能批处理适合于需要极少用户交互的Job b Interactive由许多短交易组成 下一次交易的结果可能不可预知需要响应时间短 4 1 cont c Timesharing使用CPU调度和多道程序提供对系统的经济交互式使用 CPU快速地在用户之间切换一般从终端读取控制 输出立即打印到屏幕d Realtime在专门系统中使用 从传感器读取信息 必须在规定时间内作出响应以确保正确的执行 5 1 cont e Network在通用OS上添加联网 通信功能远程过程调用文件共享f Distributed具有联网 通信功能提供远程过程调用提供多处理机的统一调度调度统一的存储管理分布式文件系统 6 1 cont 5 Describethedifferencesbetweensymmetricandasymmetricmultiprocessing Whatarethreeadvantagesandonedisadvantageofmultiprocessorsystems Symmetricmultiprocessing中所有处理器同等对待 I O可以在任意CPU上处理 Asymmetricmultiprocessing具有一个主CPU和多个从CPU 主CPU将任务分派到从CPU I O通常只能由主CPU处理 多处理机系统的优点比多个计算机系统可能更省钱 同样CPU个数 执行程序更快可靠性更高缺点 软硬件更复杂6 thinking whatkindoffeaturesmayexistinCC IOTorCPS 7 Chapter2 1 Howdoesthedistinctionbetweenmonitormodeandusermodefunctionasarudimentaryformofprotection security system 通过建立一组只能在monitormode才能执行的特权指令集 OS能够确保总是能控制整个系统 8 2 cont 2 Whatarethedifferencesbetweenatrapandaninterrupt Whatistheuseofeachfunction Aninterrupt是硬件产生的系统内的流的改变Atrap是软件产生的 中断 interrupt可以被I O用来产生完成的信号 从而避免CPU对设备的轮询Atrap可以用来调用OS的例程或者捕获算术错误 9 2 cont 3 Whichofthefollowinginstructionsshouldbeprivileged a Setvalueoftimer b Readtheclock c Clearmemory d Turnoffinterrupts e Switchfromusertomonitormode a Setvalueoftimer c Clearmemory d Turnoffinterrupts e Switchfromusertomonitormode 10 2 cont 4 Protectingtheoperatingsystemiscrucialtoensuringthatthecomputersystemoperatescorrectly Provisionofthisprotectionisthereasonbehinddual modeoperation memoryprotection andthetimer Toallowmaximumflexibility however wewouldalsoliketoplaceminimalconstraintsontheuser Thefollowingisalistofoperationsthatarenormallyprotected Whatistheminimalsetofinstructionsthatmustbeprotected a Changetousermode b Changetomonitormode c Readfrommonitormemory d Writeintomonitormemory e Fetchaninstructionfrommonitormemory f Turnontimerinterrupt g Turnofftimerinterrupt b Changetomonitormode c Readfrommonitormemory d Writeintomonitormemory g Turnofftimerinterrupt 11 Chapter3 1 Whatarethefivemajoractivitiesofanoperatingsysteminregardtoprocessmanagement 用户和系统进程地创建和删除进程的挂起和恢复提供进程同步的机制提供进程通信的机制提供死锁处理的机制 12 3 cont 2 Whatarethethreemajoractivitiesofanoperatingsysteminregardtomemorymanagement 跟踪内存使用情况 哪一部分被使用 谁使用 当内存空间可用的时候 确定将哪些进程调入内存 job调度 按需要分配和回收内存 13 3 cont 3 Whatarethethreemajoractivitiesofanoperatingsysteminregardtosecondary storagemanagement 剩余空间的管理存储分配磁盘调度 14 3 cont 4 Whatarethefivemajoractivitiesofanoperatingsysteminregardtofilemanagement 文件创建和删除目录创建和删除目录和文件操作原语的支持文件到二级存储的映射将文件备份到非易失存储设备 15 3 cont 5 Whatisthepurposeofthecommandinterpreter Whyisitusuallyseparatefromthekernel 读取命令 从用户或者命令文件 并执行 转化成系统调用 可能会经常改变 16 3 cont 6 Whatisthepurposeofsystemcalls 让用户级进程可以请求操作系统所提供的服务 17 3 cont 7 Whatisthepurposeofsystemprograms 为程序开发和运行提供了方便的环境给用户提供基本的公共功能函数 为用户在不用自己写代码的情况下解决公用问题8 试着安装虚拟机VMWARE 然后在这台虚拟机上安装一个操作系统9 阅读Linux源码 给出某一个systemcall的源码并分析 分析init main c给出流程图 18 Chapter4 1 Describethedifferencesamongshort term medium term andlong termscheduling Short term CPU调度Long term job调度Medium term 分时系统中的中间调度级 19 4 cont 2 Describetheactionsakerneltakestocontextswitchbetweenprocesses 保存正在运行的进程的状态 恢复欲调度到CPU进程的状态 20 4 cont 3 Whatarethebenefitsanddetrimentsofeachofthefollowing Considerboththesystemsandtheprogrammers levels a Symmetricandasymmetriccommunicationb Automaticandexplicitbufferingc Sendbycopyandsendbyreferenced Fixed sizedandvariable sizedmessages 21 4 cont 4 Thecorrectproducer consumeralgorithmintheppt allowsonlyn 1bufferstobefullatanyonetime Modifythealgorithmtoallowallbufferstobeutilizedfully 22 4 cont 5 Considertheinterprocess communicationschemewheremailboxesareused a SupposeaprocessPwantstowaitfortwomessages onefrommailboxAandonefrommailboxB Whatsequenceofsendandreceiveshoulditexecute b WhatsequenceofsendandreceiveshouldPexecuteifPwantstowaitforonemessageeitherfrommailboxAorfrommailboxB orfromboth c Areceiveoperationmakesaprocesswaituntilthemailboxisnonempty Eitherdeviseaschemethatallowsaprocesstowaituntilamailboxisempty orexplainwhysuchaschemecannotexist areceive A m1 receive B m2 send c m3 receive B m1 receive A m2 send c m3 breceive A m1 receive B m2 send c m3 receive B m1 receive A m2 send c m3 receive A m1 send c m3 receive B m2 receive B m1 send c m3 receive A m2 23 4 cont 6 阅读分析Linux终止进程的源码7 编程 实现一个简单网络聊天程序 用到socket和fork 接受和发送在fork出的进程中 24 Chapter5 1 Providetwoprogrammingexamplesofmultithreadinggivingimprovedperformanceoverasingle threadedsolution 可以并发的多任务Web浏览器 数据可并行处理2 Providetwoprogrammingexamplesofmultithreadingthatwouldnotimproveperformanceoverasingle threadedsolution 不可以并发的单任务用多个线程读一个文件后续的结果必须依赖于前面的 25 5 cont 3 Whataretwodifferencesbetweenuser levelthreadsandkernel levelthreads Underwhatcircumstancesisonetypebetterthantheother 内核可知与不可知调度者不同与进程的关系运行效率 内核复杂度 用户可控程度4 Whatresourcesareusedwhenathreadiscreated Howdotheydifferfromthoseusedwhenaprocessiscreated TCB 寄存器组 栈 调度信息PCB 所有与进程执行和调度相关的资源与信息 内存 打开的文件 环境变量 26 5 cont 5 WriteamultithreadedPthreadorJavaprogramthatoutputsprimenumbers Thisprogramshouldworkasfollows Theuserwillruntheprogramandwillenteranumberonthecommandline Theprogramwillthencreateaseparatethreadthatoutputsalltheprimenumberslessthanorequaltothenumberthattheuserentered 6 编程 实现一个简单网络聊天程序 用到socket和pthread 接受和发送在pthread创建的线程中 27 Chapter6 1 ACPUschedulingalgorithmdeterminesanorderfortheexecutionofitsscheduledprocesses Givennprocessestobescheduledononeprocessor howmanypossibledifferentschedulesarethere Giveaformulaintermsofn N个进程的排列问题Pnn n 2 Definethedifferencebetweenpreemptiveandnonpreemptivescheduling Statewhystrictnonpreemptiveschedulingisunlikelytobeusedinacomputercenter 对CPU控制权的主动还是被动放弃不可能采用纯非剥夺机制 考虑到多道程序 分时共享 公平和轻重缓急 28 6 cont 3 Considerthefollowingsetofprocesses withthelengthoftheCPU bursttimegiveninmilliseconds TheprocessesareassumedtohavearrivedintheorderP1 P2 P3 P4 P5 allattime0 a DrawfourGanttchartsillustratingtheexecutionoftheseprocessesusingFCFS SJF anonpreemptivepriority asmallerprioritynumberimpliesahigherpriority andRR quantum 1 scheduling b Whatistheturnaroundtimeofeachprocessforeachoftheschedulingalgorithmsinparta c Whatisthewaitingtimeofeachprocessforeachoftheschedulingalgorithmsinparta d Whichoftheschedulesinpartaresultsintheminimalaveragewaitingtime overallprocesses 29 6 cont 6 3a b c d SJF 30 6 cont 4 Supposethatthefollowingprocessesarriveforexecutionatthetimesindicated Eachprocesswillrunthelistedamountoftime Inansweringthequestions usenonpreemptiveschedulingandbasealldecisionsontheinformationyouhaveatthetimethedecisionmustbemade a WhatistheaverageturnaroundtimefortheseprocesseswiththeFCFSschedulingalgorithm 8 0 12 0 4 13 1 0 3 10 53b WhatistheaverageturnaroundtimefortheseprocesseswiththeSJFschedulingalgorithm 8 0 13 0 4 9 1 0 3 9 53c TheSJFalgorithmissupposedtoimproveperformance butnoticethatwechosetorunprocessP1attime0becausewedidnotknowthattwoshorterprocesseswouldarrivesoon ComputewhattheaverageturnaroundtimewillbeiftheCPUisleftidleforthefirst1unitandthenSJFschedulingisused RememberthatprocessesP1andP2arewaitingduringthisidletime sotheirwaitingtimemayincrease Thisalgorithmcouldbeknownasfuture knowledgescheduling 14 0 6 0 4 2 1 0 3 6 87 31 6 cont 5 Considerthefollowingpreemptivepriority schedulingalgorithmbasedondynamicallychangingpriorities Largerprioritynumbersimplyhigherpriority WhenaprocessiswaitingfortheCPU inthereadyqueuebutnotrunning itsprioritychangesatarateA whenitisrunning itsprioritychangesatarateB Allprocessesaregivenapriorityof0whentheyenterthereadyqueue TheparametersAandBcanbesettogivemanydifferentschedulingalgorithms a WhatisthealgorithmthatresultsfromB A 0 b WhatisthealgorithmthatresultsfromA B 0 FCFSLIFO 32 6 cont 6
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 用煤安全知识培训课件
- 生物安全知识培训课件简报
- 2024拆迁回迁房屋买卖合同书范本
- 急性肾功能衰竭高磷血症护理查房
- 2025年小学数学毕业升学考试应用题深度解析模拟试卷
- 生态管护课件模板
- 2025至2030中国盐酸贝那普利片行业项目调研及市场前景预测评估报告
- 辽宁在职辅警考试题库及答案
- 2025至2030中国建筑钢材行业发展分析及发展趋势分析与未来投资战略咨询研究报告
- 2025至2030中国防盗报警系统行业发展趋势分析与未来投资战略咨询研究报告
- 头皮健康与头发生长关系的研究
- 财务结账相关管理制度
- 叉车维修方案(3篇)
- 口腔科护士正确吸唾操作规范
- 中学升旗管理制度
- Odoo面试题及答案
- 2025年全国I卷英语 高考真题
- 专业公路工程知识考察试题及答案
- 陕西西安铁一中学2025届英语八下期末检测试题含答案
- 2025上半年高级软件水平考试《系统分析师(案例分析)》真题及解析
- 赃款退还协议书
评论
0/150
提交评论