您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 西安电子科技大学操作系统期末试题及答案解析
西安电子科技大学考试时间120分钟试题题号一二三四五六七八九十总分分数1.考试形式:闭卷2.考试日期:年月日3.本试卷共四大题,满分100分班级学号姓名任课老师Part1:Selectoneanswer(AthroughD)foreachquestion(Total20,each2)1.Acomputersystemconsistsof,systemprogramsandapplicationprograms.A.ControlbusB.databusC.AddressbusD.hardware2.Thread(线程)canbeimplementedin.A.KernelSpaceB.UserSpaceC.KernelSpaceorUserSpaceD.Noneoftheabove3.InOS,shorttermschedule(调度)means.A.JobschedulingB.ProcessschedulingC.ThreadschedulingD.CPUscheduling4.Whichoneofthefollowingitemisnotsharedbyallthreadsinaprocess?.A.AddressspaceB.RegisterC.OpenfilesD.Accountinginformation5.Inthepagedmemorymanagementsystem,theaddressiscomposedofpagenumberandtheoffsetwithinthepage.Intheaddressstructureshowninthefollowingfigure,.311090pagenumberoffsetA.pagesizeis512,2MpagesatmostB.pagesizeis1k,4MpagesatmostC.pagesizeis2k,8MpagesatmostD.pagesizeis4k,16Mpagesatmost6.VirtualmemoryisbasedonThePrincipleofLocality.WhichofthefollowingstatementsaboutThePrincipleofLocalityiscorrect?A.ProgramexecutescodesinorderB.Programassesses(访问)memoryinanon-uniformmannerC.ProgramaccessesalotofvariablescontinuouslyD.Programaccessesarelativelysmallportionoftheaddressspaceatanyinstantoftime7.InUNIXi-nodescheme,adirectoryentrycontainsonlytwofields:thefilename(14bytes)andthenumberofthei-nodeforthatfile(2bytes).Theseparameters(参数)limitthenumberoffilesperfilesystemto.A.64kB.32kC.16kD.4k8.Thetimerequiredtoreadorwriteadiskblockisdetermined(决定)bythreefactors.Whichonedominates(主导,占优势)theothertwotimes?.A.SeektimeB.RotationaldelaytimeC.DatatransfertimeD.Noneofabove9.Thechmodcommand(命令)isusedtochangethepermission(许可)offileinLinux.Touseit,youspecifythedesiredpermissionsettingandthefileorfilesthatyouwishtomodify.Thepermissionsettingsareusuallyaseriesofbits.Whichofthefollowingbitspresentthatthefile’sownermayread,write,andexecutethefile,whileallothersmayonlyreadthefile?.A.755B.744C.644D.61110.Themethodlistedbelowdoesn’tneedCPUtoparticipateinthetransferofdatablock.A.Interrupt-DrivenI/OB.DMAC.ProgrammedI/OD.NoneofabovePart2:FillBlanks(Total20,each2)1.OperatingSystemisanextendedmachineand.2.ParallelSystemsincludeSymmetric(对称)multiprocessingand.3.Asemaphore(信号量)Sisanintegervariablethatisaccessedonlythroughtwostandardatomicoperations:and.4.Addressbindingofinstructionsanddatatomemoryaddressescanhappenatthreedifferentstages,Compiletime,Loadtimeand.5.FourConditionsforDeadlock:,Holdandwait,Nopreemptionand.6.Sector0ofthediskiscalledthe.7.InLinux,thefilemetadata(元数据)isstoredin.8.Thesecuritygoalsincludedataconfidentiality(机密性),dataintegrityand.Part3:EssayQuestions(Total20,each4)1.Whatissystemcall?Useanexampletoillustrate(举例说明)thestepsofsystemcall.2.Pleasedescribethediagram(图)ofProcessState.3.WhatisMonitor?CanyouuseMonitortoimplementadatastructure?4.WhatisTLB?Whatroledoesitplayinmemorymanagement?5.ThedifferenceofprogrammingI/Oandinterrupt-drivenI/O.Part4:IntegrateQuestions(Total40,each10)1.Thecodebelowisanexampleprogramofproducer-consumer.Theproductproducenumbersfrom1toMAXandtheconsumerwillreadit.Pleasefillblanksinthecode#includestdio.h#includepthread.h#defineMAX1000000000/*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(①)pthread_cond_wait(&condp,&the_mutex);buffer=i;②③}pthread_exit(0);}void*consumer(void*ptr)/*consumedata*/{inti,res;for(i=1;i=MAX;i++){pthread_mutex_lock(&the_mutex);while(④)pthread_cond_wait(⑤,&the_mutex);res=buffer;buffer=0;pthread_cond_signal(&condp);⑥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);}2.Considerthefollowingsnapshotofasystem:ResourcesProcessesAllocationABCDMaxNeedABCDAvailableABCDP0P1P2P3P400121000135406320014001217502356065206561520Answerthefollowingquestionsusingthebanker’salgorithm:(1)WhatisthecontentofthematrixNeed?(4points)(2)Isthesysteminsafestate?Why?(3points)(3)IfarequestfromprocessP1arrivesfor(0,4,2,0),cantherequestbegranted(允许)immediately?(3points)3.Diskrequestscomeintothediskdriverforcylinders10,22,20,2,40,6,and38,inthatorder.Inallcases,thearmisinitiallyatcylinder20.Aseektakes6msecpercylindermoved.Howmuchseektimesisneededfor(1)FirstComeFirstServed(FCFS).(3points)(2)ShortedSeekTimeFirst(SSTF).(3points)(3)Elevatoralgorithm(SCAN,initiallymovingupward)(4points)4.Considerasystemwherethevirtualmemorypagesizeis2K(2048bytes),andmainmemoryconsistsof4pageframes.Nowconsideraprocesswhichrequires8pagesofstorage.Atsomepointduringitsexecution,thepagetableisasshownbelow:VirtualpageValidPhysicalpage0No1No2Yes13No4Yes35No6Yes07Yes2Answerthefollowingquestions:(1)Listthevirtualaddressrangesforeachvirtualpage.(3points)(2)Listthevirtualaddressrangesthatwillresul
本文标题:西安电子科技大学操作系统期末试题及答案解析
链接地址:https://www.777doc.com/doc-5832812 .html