




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
西安电子科技大学操作系统期末试题及答案解析西安电子科技大学操作系统期末试题及答案解析西安电子科技大学操作系统期末试题及答案解析资料仅供参考文件编号:2022年4月西安电子科技大学操作系统期末试题及答案解析版本号:A修改号:1页次:1.0审核:批准:发布日期: 西安电子科技大学 考试时间120分钟试 题题号一二三四五六七八九十总分分数1.考试形式:闭卷2.考试日期:年月日3.本试卷共四大题,满分100分班级学号姓名任课老师Part1:Selectoneanswer(AthroughD)foreachquestion(Total20,each2)Acomputersystemconsistsof,systemprogramsandapplicationprograms.ControlbusB.databusAddressbus D.hardwareThread(线程)canbeimplementedin.KernelSpace B.UserSpaceC.KernelSpaceorUserSpace D.NoneoftheaboveInOS,shorttermschedule(调度)means.
A.Jobscheduling B.Processscheduling
C.Threadscheduling D.CPUschedulingWhichoneofthefollowingitemisnotsharedbyallthreadsinaprocess
.
A.Addressspace B.RegisterC.Openfiles D.AccountinginformationInthepagedmemorymanagementsystem,theaddressiscomposedofpagenumberandtheoffsetwithinthepage.Intheaddressstructureshowninthefollowingfigure, .311090pagenumberoffsetA.pagesizeis512,2MpagesatmostB.pagesizeis1k,4MpagesatmostC.pagesizeis2k,8MpagesatmostD.pagesizeis4k,16MpagesatmostVirtualmemoryisbasedonThePrincipleofLocality.WhichofthefollowingstatementsaboutThePrincipleofLocalityiscorrect
A.ProgramexecutescodesinorderProgramassesses(访问)memoryinanon-uniformmannerProgramaccessesalotofvariablescontinuouslyProgramaccessesarelativelysmallportionoftheaddressspaceatanyinstantoftimeInUNIXi-nodescheme,adirectoryentrycontainsonlytwofields:the
filename(14bytes)andthenumberofthei-nodeforthatfile(2bytes).Theseparameters(参数)limitthenumberoffilesperfilesystemto
.
A.64k B.32k
C.16k D.4kThetimerequiredtoreadorwriteadiskblockisdetermined(决定)bythreefactors.Whichonedominates(主导,占优势)theothertwotimes
.
A.Seektime B.Rotationaldelaytime
C.Datatransfertime D.NoneofaboveThechmodcommand(命令)isusedtochangethepermission(许可)offileinLinux.Touseit,youspecifythedesiredpermissionsettingandthefileorfilesthatyouwishtomodify.Thepermissionsettingsareusuallyaseriesofbits.Whichofthefollowingbitspresentthatthefile’sownermayread,write,andexecutethefile,whileallothersmayonlyreadthefile
.
A.755 B.744 C.644 D.611Themethodlistedbelowdoesn’tneedCPUtoparticipateinthetransferofdatablock.Interrupt-DrivenI/O B.DMAC.ProgrammedI/O D.NoneofabovePart2:FillBlanks(Total20,each2)OperatingSystemisanextendedmachineand.ParallelSystemsincludeSymmetric(对称)multiprocessingand.Asemaphore(信号量)Sisanintegervariablethatisaccessedonlythroughtwostandardatomicoperations:and.Addressbindingofinstructionsanddatatomemoryaddressescanhappenatthreedifferentstages,Compiletime,Loadtimeand.FourConditionsforDeadlock:,Holdandwait,Nopreemptionand.Sector0ofthediskiscalledthe.InLinux,thefilemetadata(元数据)isstoredin.Thesecuritygoalsincludedataconfidentiality(机密性),dataintegrityand.Part3:EssayQuestions(Total20,each4)WhatissystemcallUseanexampletoillustrate(举例说明)thestepsofsystemcall.Pleasedescribethediagram(图)ofProcessState.WhatisMonitorCanyouuseMonitortoimplementadatastructureWhatisTLBWhatroledoesitplayinmemorymanagementThedifferenceofprogrammingI/Oandinterrupt-drivenI/O.Part4:IntegrateQuestions(Total40,each10)Thecodebelowisanexampleprogramofproducer-consumer.Theproductproducenumbersfrom1toMAXandtheconsumerwillreadit.Pleasefillblanksinthecode#include<>#include<>#defineMAX00/*howmanynumberstoproduce*/pthread_mutex_tthe_mutex;pthread_cond_tcondc,condp;intbuffer=0; /*bufferusedbetweenproducerandconsumer*/void*producer(void*ptr)/*producedata*/{ inti;for(i=1;i<=MaX;i++){pthread_mutex_lock(&the_mutex);while(=1\*GB3①)pthread_cond_wait(&condp,&the_mutex);buffer=i;=2\*GB3② =3\*GB3③ } pthread_exit(0);}void*consumer(void*ptr)/*consumedata*/{ inti,res;for(i=1;i<=MAX;i++){ pthread_mutex_lock(&the_mutex);while(=4\*GB3④)pthread_cond_wait(=5\*GB3⑤,&the_mutex);res=buffer;buffer=0;pthread_cond_signal(&condp); =6\*GB3⑥
printf(“buffer=%d\n”,res); } pthread_exit(0);}
intmain(intargc,char**argv)
{pthread_tpro,con; pthread_mutex_init(&the_mutex,0);pthread_cond_init(&condc,0);pthread_cond_init(&condp,0);pthread_create(&con,0,consumer,0);
pthread_create(&pro,0,producer,0);pthread_join(pro,0); pthread_join(con,0);pthread_cond_destroy(&condc);pthread_cond_destroy(&condp);
pthread_mutex_destroy(&the_mutex);}Considerthefollowingsnapshotofasystem:ResourcesProcessesAllocationABCDMaxNeedABCDAvailableABCDP0P1P2P3P4012000135406320014001217502356065206561520Answerthefollowingquestionsusingthebanker’salgorithm:WhatisthecontentofthematrixNeed(4points)IsthesysteminsafestateWhy(3points)IfarequestfromprocessP1arrivesfor(0,4,2,0),cantherequestbegranted(允许)immediately
(3points)Diskrequestscomeintothediskdriverforcylinders10,22,20,2,40,6,and38,inthatorder.Inallcases,thearmisinitiallyatcylinder20.Aseektakes6msecpercylindermoved.HowmuchseektimesisneededforFirstComeFirstServed(FCFS). (3points)ShortedSeekTimeFirst(SSTF). (3points)Elevatoralgorithm(SCAN,initiallymovingupward) (4points)Considerasystemwherethevirtualmemorypagesizeis2K(2048bytes),andmainmemoryconsistsof4pageframes.Nowconsideraprocesswhichrequires8pagesofstorage.Atsomepointduringitsexecution,thepagetableisasshownbelow:VirtualpageValidPhysicalpage0No1No2Yes13No4Yes35No6Yes07Yes2Answerthefollowingquestions:Listthevirtualaddressrangesforeachvirtualpage. (3points)Listthevirtualaddressrangesthatwillresultinapagefault. (3points)Givethemainmemory(physical)addressesforeachofthefollowingvirtualaddresses(allnumbersdecimal):(i)8500,(ii)1400,(iii)5000,(iv)2100. (4points)AnswersPart1:Selectoneanswer(AthroughD)foreachquestion1. D计算机系统由硬件和软件(系统程序+应用程序)组成。2. C线程实现的两种方式——用户空间和内核中①在用户空间中实现线程 内核对线程包一无所知,从内核角度考虑,就是按正常的方式管理,即单线程进程(存在运行时系统)②在内核中实现线程 在某个线程希望创建一个新线程或撤销一个已有线程时,它进行一个系统调用,这个系统调用通过对线程表的更新完成线程创建和撤销工作。③混合实现 在此模型中,每个内核级线程有一个可以轮流使用的用户级线程集合。3. D三级调度:①long-termschedule(长期调度,又称作业调度):哪个程序被系统选中并创建进程运行它②medium-termschedule(中期调度,又称内存调度):决定是否将进程调入内存③short-termschedule(短期调度,又称CPU调度):哪个进程获得处理器资源(通常所说的调度)4. B一个进程中所有线程共享的内容(进程的属性):每个线程独有的内容:5. B页面数(pagenumber)===4M由页内偏移(offset)得,页面大小(pagesize)===1K6. D答案:程序在一段时间内访问相对小的一段地址空间虚拟内存基于程序的局部性原理而设计的。程序的局部性原理是指程序在执行时呈现出局部规律,即在一段时间内,整个程序的执行仅限于程序中的某一部分。相应地,执行所访问的存储空间也局限于某个内存区域。(根据程序的局部性理论,Denning提出了工作集理论)7. AUNIX的一个目录项包含了两个域,文件名(14个字节)和节点的编号(2个字节),这些参数决定了每个文件系统的文件数目为64K()8. ATimerequiredtoreadorwriteadiskblockdeterminedby3factors:—Seektime(thetimetomovethearmtothepropercylinder)(寻道时间)—Rotationaldelay(thetimeforthepropersectortorotateunderthehead)(旋转延迟)—Actualdatatransfertime(实际数据传输时间)Formostdisks,theseektimedominatestheothertwotimes.9. Bchmod命令,改写文件的读写许可设置语法为:chmodabcfile其中a,b,c各为一个数字,分别表示User,Group,Other的权限r=4,w=2,x=1所以,a=4+2+1=7b=4c=410. BI/O可以以三种不同方式实现:①程序控制I/O(ProgrammedI/O) 让CPU做全部的工作。CPU通过程序主动读取状态寄存器以了解接口情况,并完成相应的数据操作。②中断驱动I/O(interrupt-drivenI/O) 当程序常规运行时,若外部有优先级更高的事件出现,则通过中断请求通知CPU,CPU再读取状态寄存器确定事件的种类,执行不同的分支处理。③DMA(DirectMemoryAccess) 直接内存存取即数据传送的具体过程直接由硬件(DMA控制器)在内存和I/O之间完成,CPU只在开始时将控制权暂时交予DMA,直到数据传输结束。Part2:FillBlanks1.aresourcemanager2.asymmetricmultiprocessing(非对称多处理)3.P V4.executiontime5.Mutualexclusion Circularwait6.MBR(MasterBootRecord)主引导记录7.i-node8.systemavailabilityPart3:EssayQuestions1.操作系统的主要功能是为应用程序的运行创建良好的环境,为了达到这个目的,内核提供一系列具备预定功能的多内核函数,通过一组称为系统调用(systemcall)的接口呈现给用户。系统调用把应用程序的请求传给内核,调用相应的的内核函数完成所需的处理,将处理结果返回给应用程序,如果没有系统调用和内核函数,用户将不能编写大型应用程序。2.1)Running运行态2)Ready就绪态.,暂无CPU分配得它。3)Blocked阻塞态,等待输入3.管程是一个由过程、变量和数据结构等组成的一个集合,它们组成一个特殊的模块或软件包。进程可在任何需要的时候调用管程中的过程,但它们不能在管程之外声明的过程中直接访问管程内的数据结构。任一时刻管程中只能有一个活跃进程,这一特性使管程能有效地完成互斥。4.TLB即TranslationLookasideBuffer(转换检测缓冲区),是一个小型的硬件设备将虚拟地址直接映射到物理地址,不必再访问列表。它通常存在在MMU中,包含少量的表项,每个表项记录了一个页面的相关信息,包括虚拟页号、页面的修改位、保护码(读/写/执行权限)和该页所对应的物理页框。它是一个内存管理单元用于改进虚拟地址到物理地址转换速度的缓存。5.①程序控制I/O(ProgrammedI 让CPU做全部的工作。CPU通过程序主动读取状态寄存器以了解接口情况,并完成相应的数据操作。 ②中断驱动I/O(interrupt-drivenI/O) 在等待设备就绪的时候允许CPU做其他的事情。当程序常规运行时,若外部有优先级更高的事件出现,则通过中断请求通知CPU,CPU再读取状态寄存器确定事件的种类,执行不同的分支处理。Part4:Int
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 教育行业数字化转型与精准教学
- 教育技术如何衡量并提升学生成绩
- 2024-2025学年度南昌交通学院单招《职业适应性测试》高频难、易错点题及完整答案详解(易错题)
- 2024年郑州西亚斯学院单招《职业适应性测试》检测卷(模拟题)附答案详解
- 燃气施工安全培训课件
- 幼儿园后勤管理培训
- 资料员培训资料编制要点
- 学易金卷:段考模拟君之2025-2026学年高一英语下学期期中考试原创模拟卷03(答题卡)
- 2024年安徽大学江淮学院辅导员考试真题
- 2025建筑安全月培训
- 2025年四川省自贡市中考物理试卷及答案
- 2025年度卫生招聘考试(财务)新版真题卷(附详细解析)
- 2025年6月14日萍乡市事业单位面试真题及答案解析
- 2025年环境工程考试试卷及答案
- 毕业答辩-拆装式自走式单轨道山地果园运输机设计
- 2025年高考真题-语文(全国二卷) 含解析
- 2025年庐山市国有投资控股集团有限公司招聘笔试冲刺题(带答案解析)
- 2024年深圳市中考生物试卷真题(含答案解析)
- 2025年天津市西青区八年级会考模拟生物试卷(含答案)
- 企业隐患内部报告奖励和安全生产“红线”两项制度参考资料
- 纺纱工高级工职业鉴定试卷及答案
评论
0/150
提交评论