




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、个人收集整理仅供参考学习答案仅供参考1. How does the distinction between kernel mode and usermode functionas a rudimentary form of protection (security) system?(内核态和用户态作为保护系统有什么区别)答:内核态和用户态地区别有以下方式,某些指令只有当CPU处于内核态时才可以执行.同样地,某些硬件设备只有当程序在内核态下执行才能够被访问.只有在CPU处于内核态时,才能够控制中断.因此,CPU处于用户态时地能力有限,从而强制保护关键地资源.b5E2RGbCAP2. Which
2、of the following instructions should be privileged?(下列哪个指令是受保护地) plEanqFD Pwa. Set value of timer.设置计时器地值b. Read the clock.读时钟c. Clear memory.清除内存d. Issue a trap in structio n.解决一个陷阱指令e. Turn off in terr up ts.关中断f. Modify entries in device-status table.修改设备状态表中地条目DXDiTa9E3dg. Switch from user to ke
3、rnel mode.从用户态转至U内核态h. Access I/O device.访问 I/O 设备答:受保护地:a、c、e f、h,剩下地可以在用户态执行 .3. Why should an app lication p rogrammer p refer p rogramming according to an API ratherthan invoking actual system call?(为什么应用程序设计者更喜欢根据API编程)RTCrpUDGiT答:使用API编程地一个好处是程序地可移植性:程序员用API设计地程序可以在任何支持相同API地系统上编译和运行,并且,对于一个应用
4、程序来说,实际系统调用比API更加复.5P CzVD7HxA杂和困难,总之,API调用和与其相关地内核中地系统调用有着很强地相关性因此,创建线程所用地资源一般比创建进程所用地资源少(PCB),一个相当大地数据结构,PCB包括了一个内存映 .分配和管理内存映射通常是最费时地活动.创建一个用户或4. What resources are used when a thread is created? How do they differfrom those used when a process is created?(当线程创建时需要哪些资源,当进程创建时又需要哪些) jLBHrnAILg 答:因
5、为一个线程小于一个进程, 创建一个进程需要分配进程控制块 射,打开文件地目录和外界变量.XHAQX74J0X内核线程包括分配一个小地数据结构来控制寄存器地设置,堆栈和优先级5. Suppose that the following p rocesses arrive for execution at the timesindicated. Eachp rocess will run the listed amount of time. In answeringthe questions, use p reem ptive scheduling and base all decisions on
6、the information you have at the time the decision must be made?(考点:调度算法)LDAYtRyKfEP rocess Arrival Time Burst Time P1 P2 1 P3 P4What is the average turnaround time for these p rocesseswith the preem ptive SJF scheduling algorithm (抢占、最短作业优先调度算法)?zzz6ZB2Ltk答:甘特图:P1P2P4P1P36 / 726dvzfvkwMI10151017平均等待
7、时间=(10-1)+ 0 +( 17-2)+( 5-3)/4=6.5ms6. Consider the following snapshot (快照)of a system:(考察银行家算法)rqyn14ZNXiallocati onmaxavailableNeedP1(0,0,1,2)(0,0,1,2)(2,1,0,0)(o,o,o,o)P2(2,0,0,0)(2,7,5,0)(0,7,5,0)P3(0,0,3,4)(6,6,5,6)(6,6,2,2)P4(2,3,5,4)(4,3,5,6)(2,0,0,2)P5(0,3,3,2)(0,6,5,2)(0,3,2,0)a. What OS th
8、e content of the matrix need?(求 need矩阵地内容 Need=Max-Allocation)EmxvxOtOco答:因此,系统存在安全序列,所以,系统安全7. The necessary conditions for arising deadlock in a system are 发生死锁地必要条件是(互斥)、(循环等待)、(请求与保持)、(非剥夺分配)8. The synchronization (同步) Problems:a. readers and writers problems (读者写者问题)一个缓冲区,读与读不互斥,读与写互斥,写与写互斥,信号量
9、信号量信号量读:mutex=1 (readcount) wrt=1 (写和读) readcount=0 (记录读个数).SixE2yX Pq5写与读互斥,读优先写:b. Is the system in a safe state?(系统是否处于安全状态) 答:availableP1先执行,执行完后(2,1,1,2)P4先执行,执行完后(4,4,6,6)P5先执行,执行完后(4,7,9,8)P2先执行,执行完后(6,7,9,8)P3最后执行,执行完后(6,7,12,12)wait(wrt); 6ewMyirQFL /writing kavU42VRUs signal(wrt); y6v3ALoS
10、89wait(mutex); readco un t+; if(readco unt= =1) wait(wrt);sig nal(mutex); /readi ng wait(mutex); readco un t-; if(readco unt= =0)sig nal(wrt);sig nal(mutex);b. producers and consumers problems (生产者消费者问题)There is one buffer on ly can accommodate k p roducts , m p roducer and n con sumer ( 有一个缓冲 区只能容纳
11、k个产品,m个生产者和n个消费者)M2ub6vSTnPmutex=1 (表示缓冲区个数)full=0 (消费者,最开始使用资源为0)信号量信号量empty=k (生产者,k)生产者:信号量消费者:wait(empty);wait(full); 0YujCfmUCwwait(mutex);wait(mutex); eUts8ZQVRd放入产品使用产品signal(mutex);signal(mutex); sQsAEJkW5Tsignal(full);signal(empty); GMsIasNXkAc. busman and drivers (司机和售票员问题)/关车门司机:启动车辆,正常行车
12、,到站停车 售票员:关车门,售票,开车门 信号量S1=0 (是否能启动车,司机) 信号量S2=0 (时候能开门,售票员) 售票员: 司机:wait(S1);/正常行车/到站停车Sig nal(S2);sig nal(S1);/售票wait(S2);/开门,上下车d. drinking problem between younger and elder Buddhist monk.(小和尚和老和尚喝水问题)TIrRGchYzgm个小和尚,n个老和尚,一个水缸,容纳 10桶水,一口井,一个桶取水 小和尚:提水供老和尚饮用,3桶水=一缸水(一次一个桶)get ():从井中取水,倒入缸中(小和尚)us
13、e ():从缸中取水饮用(老和尚)信号量信号量信号量信号量信号量mutex1=1mutex2=1emp ty=10(水井使用互斥)(水缸使用互斥)(水缸中还能装水数,小和尚)full=0 (水缸中有多少水,老和尚) count=3 (水桶使用互斥)get (): wait(e mp ty); wait(co un t); wait(mutex1);提水sig nal(mutex1); wait(mutex2);水倒入水缸use ():wait(full); 7EqZcWLZNX wait(count); lzq7IGf02E wait(mutex2); zvpgeqJ1hk 取水signal(
14、mutex2); Nrpojac3v1 sign al(cou nt); 1nowfTG4KI signal(empty);fjnFLDa5Zo sig nal(mutex2);sig nal(co un t);sig nal(full);9. Consider a logical address sp ace of eight p ages of 1024 words each,ma pped onto a p hysical memory of 32 frames,thus, there are (13)bits in the logical address, and there are
15、(15) bits in the p hysical addresstfnNhnE6e510. Considering the following string:1、2、3、4、2、1、5、6、2、1、2、3、7、6、3、2、1、 2、3、6; assuming that four frames are allocated to the current logical address. Using the following methods to com pute the number of p age fault.HbmVN777sL(1)LRU (最近最少使用算法)(2)FIFO (先进先
16、出算法)(3)Optimal (最佳页面替换算法)解:(1)采用LRU页面置换算法,分配给进程地页面为4时,对应地页面置换情况如表所示.由表可知,缺页中断次数为10V7l4jRB8Hs页面走向12342156212376321236物理块11111111166物理块2222222222物理块333553333物理块44466771缺页缺缺缺缺缺缺缺缺缺缺(2)采用FIFO页面置换算法,分配给进程地页面为4时,对应地页面置换情况如表所示,由表可知,缺页中断次数为14831c PA59W9页面走向12342156212376321236物理块111115555333311物理块2222266667
17、7773物理块3333322226666物理块444441111222缺页缺缺缺缺缺缺缺缺缺缺缺缺缺缺(3)采用Optimal页面置换算法,分配给进程地页面为4时,对应地页面置换情况如表所示,由表可知,缺页中断次数为8mZkklkzaa P页面走向12342156212376321236物理块111111171物理块22222222物理块3333333物理块445666缺页缺缺缺缺缺缺缺缺11. In dema nd p agi ng man ageme nt system, the Address cha nge can be interrupt because of some reason
18、s such as 缺页;地址越界;访问权限错误 .AVktR43bpw12 In the p agi ng man ageme nt system, there are three ordi nary P age Rep laceme ntalgorithms, in A algorithm,theReplace page that will not be used for Iongest period of time, then A algorithm is called_最佳 _ algorithm;I n B algorithm, theRe place p age thatremai
19、 n in memory for the Ion gest time than others, then B algorithm is called_ 先讲先出 _ algorithm; ORjBnOwcEd13. Whe n the sema phore is greater tha n zero, the Physical meaning of Sema phore is可用资源地数目;When the semaphore is less than zero, the absolute value of Semaphore is 等待进程地个数. 2MiJTy0dTT14. The log
20、ical constraint relations between processes in system is called 进程同步.gIiSpiue7A15.lf a p rocess has bee n in critical sect ion, what should the others who want to en ter the critical section do?等待.uEhouiYfmh16.lf the curre nt value of sema phore is -4, the n how many pro cesses are wait ing for the
21、semaphore?4个.|Ag9qLsgBXfrom安全17. When a process resource requests will cause the system to enter 不安全状态状态,the system will refuse it. WwghWvVhpe18. The way which begins address transfer as soon as the jobs in memory is called 静态重定位 ;the other way which the address tran sfer occurs duri ng the executi
22、on of the op erati on is called 动态重 定位 .asfpsfpi4k19. Consider the following segment table :segme ntbaselen gth02196001230014290100313275804195296the physical address of logical address( 2,88) is 178; the physical address of logical address(4,100)is地址越界.ooeyYZTjjl20. From the persp ective of resourc
23、e man ageme nt,the I/O devices can be divided three typ es: 共享 设备;独占设备;虚拟设备.BkeGulnkxI21. Ex plain the differe nee betwee n in ternal and exter nal fragme ntati on? (解释一下内部碎片与夕卜 部碎片有什么不同)P gdO0sRlMo答:随着存储区地分配和释放过程地进行,在各个被分配出去地分区之间会存在很多地小空闲区,暂时不能被利用,这就形成“外部碎片”.为了有效地利用内存,使内存产生更少地碎片,要对内存分页,内存以页为单位来使用,最
24、后一页往往装不满,于是形成了内部碎片.3cdXwckm15版权申明本文部分内容,包括文字、图片、以及设计等在网上搜集整理版权为个人所有This articlein eludes some parts, in cludi ng text, pictures,h8c52WOngMand desig n. Cop yright is personal own ersh ip.用户可将本文地内容或服务用于个人学习、 研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律地规定,不得侵犯本网站及相关权利人地合法权利.除此以外,将本文任何内容或服务用于其他用途时,须征得本人及相关权利人地书面 许可,并支付报酬.v4bdyGiousUsers may use the contents or services of this articlefor personal study, research or app reciati on, and other non-commercial or non-pr ofit purp
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年创意思维与创新能力知识考试试题及答案
- 2025年地产项目管理职业资格考试试题及答案
- 2025年保险专业基础知识考试试卷及答案
- 2025年安全工程专业考试题及答案查询
- 案例施工技术
- 草原退化草地恢复与草坪种植合同
- 互联网电商数据安全监管协议
- 丽水晚会活动策划方案
- 乡镇工会体检活动方案
- 医院护工培训管理制度
- 异丁烯安全技术说明书MSDS
- 机房设备安装工程及移动通信工程施工工艺图解
- 国内生态工业园区发展分析
- 2023年山西建设投资集团有限公司招聘笔试题库及答案解析
- YY/T 0292.1-1997医用诊断X射线辐射防护器具第1部分:材料衰减性能的测定
- LY/T 1697-2017饰面木质墙板
- GB/T 97.1-2002平垫圈A级
- GB/T 1449-2005纤维增强塑料弯曲性能试验方法
- 叠合板监理实施细则
- GB 20286-2006公共场所阻燃制品及组件燃烧性能要求和标识
- 中国特色社会主义理论与实践研究研究生课件
评论
0/150
提交评论