第二学期操作系统考卷.docx
- 文档编号:3647035
- 上传时间:2022-11-24
- 格式:DOCX
- 页数:9
- 大小:40.43KB
第二学期操作系统考卷.docx
《第二学期操作系统考卷.docx》由会员分享,可在线阅读,更多相关《第二学期操作系统考卷.docx(9页珍藏版)》请在冰豆网上搜索。
第二学期操作系统考卷
北京交通大学
2009―2010学年第二学期期末考试
课程名称:
操作系统与实践出题教师:
孔令波袁岗刘铎
专业:
_____班级:
____姓名:
____学号:
____
题号
一
二
三
四
五
总分
得分
阅卷人
------------------------------------------------
Section1.FilltheBlank:
Thereare20blanks.Pleaseselectthemostproperanswertofillintheblank.(20score)
1.Whenwedesignainteractiveoperatingsystemwemustpaymoreattentionto①______________;whenwedesignabatchoperatingsystemwemustpaymoreattentionto②______________.
①②flexibleandapplicability;responseandproportionality;turnaroundtimeandthroughput;meetingdeadlinesandpredictability
2.Ifweuseround-robinschedulealgorithm,thenwhentheprocessrunsoutoftimepiecesitwillturnto③_________.
③blocked;running;ready;suspend;swap;deadlock;exit;killed
3.④_____________isakindofspecialvariablewhichcanonlybemodifiedbytwooperations:
wait()andsignal().Itcanbeusedtoimplementthecontrolmechanismamongseveralasynchronouslyconcurrentrunningprocesses,including⑤_______________and⑥____________.⑤meanstoshareresourcesexclusively,while⑥appliestocontroltheexecutionorderbetweentwoprocessesinlogic.⑦______________isalsoaspecialdatastructureusedfortheabovecontrolmechanism,whichcombines⑤and⑥togetherinonemodule.The⑧_______________in⑦isusedtoimplementthefunctionof⑥.
④⑤⑥⑦⑧:
scheduling;class;process;mutualexclusion;semaphore;controlvariable;conditionvariable;monitor,synchronization;sharedvariable;procedure;dispatching
4.The⑨______pagereplacementalgorithmhasBelady’sAnomaly.
⑨LRU;OPT;FIFO;Round-robin
5.A80Gharddisk,eachblocksizeis1K,andeachtableentryneeds4bytes,thenitsFATneed⑩______memoryspace.
⑩100M;160M;320M;480M
6.ThetwobasicfeaturesofanOSare⑪______andsharing.
⑪concurrency;efficiency;virtualization;asynchronism;convenience
7.TherearefourmainmethodsoftransferringinformationbetweenCPUandI/O,asprogramming(orpolling),
______,
______,and
______.
spooling;interrupt;PCI;DMA;SCSI;USB;northbridge;southbridge;channel;printerport
8.Acomputerusesthedynamicrelocationscheme.Aprogramis5,000byteslongandisloadedataddress2,400.Thenthebaseregister’svalueshouldbe
______,andthelimitregister’svalueshouldbe
______.
2400;7400;5000;2600
9.WhenwemanagethememorybyusingPagingwithSegmentation.Thevirtualaddressisdividedtothreeparts,as
________,
______andoffset.
segmentnumber;segmentpartition;mainbootsection;pagenumber;pagefault;pagerestore;pageage;offset;cache;TLB;pointer;pageframe
10.Diskaccesstimeisconstitutedbythe
anddatatransmissiontime.
scheduletime;seektime;sectortime;rotationallatencytime;cylindertime
Section2.Selection.Thereare10questions,and2scoresperquestion,intotal20scores.Just1answeriscorrectinthe4selects,pleasechooseitout.
1.Twoprocesses,AandB,eachneedthreerecords,1,2,3,inadatabase.IfAasksforthemintheorder1,2,3,theninwhichorderBasksforthem,deadlockisnotpossible.()
A.1,2,3B.2,1,3C.3,2,1D.1,3,2
2.Itissurethatthetransition()isneveroccurringintheprocess’3states.
A.running->readyB.ready->waiting
C.running->waitingD.waiting->ready
3.Theinitialvalueofasemaphoreis2.Itscurrentvalueis-1now.Thatmeansthereis/are()processeswaitingforthissemaphore.
A.0B.1C.2D.3
4.Inasingleprocessorsystem,thereare10processesinthesystem,andthenthemostamountofprocessintherunningstateis().
A1B8C10D9
5.Letthememoryaccesstimebe100nanosecondsandtheaveragepage-faultservicetimebe8milliseconds.Whatisthemaximumacceptablepage-faultrateforalleffectiveaccesstimeofnomorethan10microseconds?
()
Note:
1nanosecond=10-9s;1milliseconds=10-3s;
1microseconds=10-6s
A.0.224%B.0.124%C.1.24%D.2.24%
6.FromthedirectoryandtheFATgivenasfollows,weknowthelastblockofthefilewiseis().
FAT
0
/
1
6
2
/
3
8
4
9
5
/
6
3
7
/
8
2
9
5
Filename
Firstblock
wise
1
star
4
A.0B.2C.5D.7
7.Thereare4jobs,arrivedalmostsimultaneouslywiththeorder:
J1J2J3J4.Thoserunningtimearelistedasfollow.
JOB
RUNNINGTIME
J1
10minutes
J2
4minutes
J3
6minutes
J4
2minutes
WhatistheaverageturnaroundtimeforthefourjobsusingRound-Robinschedulingalgorithmwithtimesliceequalsto2minutes?
()
A.13minutesB.15minutes
C.14minutesD.16minutes
8.Inanewfilesystem,thefree-spaceismanagedusingBitVector.Supposethatblocksizeequals2Kbytesandthedisksizeis8gigabyte.Itiseasytoseethatthebitmapforthediskcontains()blocks.
A.64B.128C.256D.512
9.InContiguousMemoryAllocationstrategy,theleftover[剩余的;边角料的]space,afterprogramassignment,iscalled_________fragmentation.
A.externalB.wasteC.internalD.allocated
10.Thereare4processessharing9resources.Fordynamicallyavoiddeadlock,themostnumberofresourcewhicheveryprocesscouldrequestis
A.1B.2C.3D.4
Section3.Answerthefollowingquestions.Thereare4questions,intotal20scores
1(5pts).Acomputerhassixtapedrives,withnprocessescompetingforthem.Eachprocessmayneedtwodrives.Forwhichvaluesofnisthesystemdeadlockfree?
2(5pts).Considerthefollowingsegmenttable:
Segment
Base
Length
0
120
600
1
2100
18
2
860
100
Whatarethephysicaladdressesforthefollowinglogicaladdresses?
(a)0,430
(b)1,20
(c)2,64
3(5pts).Considerthetrafficdeadlockdepictedinthefollowingfigure.
a)Pointoutthatwhichresourcesaremutualexclusion.Whichconditionsareholdandrequesting?
Whichconditionisnon-preemptable?
Whichoneiscirclewaiting?
b)Stateasimplyruleforavoidingdeadlocksinthissystem.
(Here,A,B,C,andDareintersections.)
4(5pts).Considerthefollowingsnapshotofasystem:
Allocation
Max
Available
A
B
C
D
A
B
C
D
A
B
C
D
P1
0
0
1
2
0
0
1
2
2
1
0
0
P2
2
0
0
0
2
7
5
0
P3
0
0
3
4
6
6
5
6
P4
2
3
5
4
4
3
5
6
P5
0
3
3
2
0
6
5
2
Answerthefollowingquestionsusingthebanker'salgorithm:
(a)WhatisthecontentofthematrixNeed?
(b)Isthesysteminasafestate?
(c)IfarequestfromprocessP3arrivesfor(0,2,0,0),cantherequestbegrantedimmediately?
Section4.Calculations.Thereare4questions,intotal30scores.
1(6pts).Hereisamulti-programmingsystem,whichhas1processorandtwoIOdevices.Threejobs,calledJ1,J2andJ3,comeatthesametime.J1hashighestpriority,J2hassecondone,andJ3hasthird.Thetimesequencestheyusearelistedasfollows.
J1:
I2(30ms);CPU(10ms);I1(30ms);CPU(10ms);I2(20ms)
J2:
I1(20ms);CPU(20ms);I2(40ms)
J3:
CPU(30ms);I1(20ms);CPU(10ms);I1(10ms)
Inthesystem,CPUoperationandIOoperation(IO1andIO2)workinparallel,andIO1andIO2arealsoworkingparallel.TheCPUutilizationcanbepreempted,buttheIOoperationcannotbepreempted.
Yourtasksare:
(a)Calculatethetimewhentheyarrivedtilltheyhavefinished.(b)CalculatetheutilizationtimeofCPU.
(c)TheutilizationtimeofIOdevices.
2(7pts).Supposethatadiskdrivehas200cylinders,numbered0to199.Thedriveiscurrentlyservingarequestatcylinder143,andthepreviousrequestwasatcylinder125.Thequeueofpendingrequests,inFlFOorder,is:
86,147,91,177,94,150,102,175,130.
Startingfromthecurrentheadposition,whatisthetotaldistance(incylinders)thatthediskarmmovestosatisfyallthependingrequestsforeachofthefollowingdisk-schedulingalgorithms?
(a)FCFS(b)SSTF(c)SCAN
3(8pts).Givenmemorypartitionsof100K,500K,200K,300K,and600K(inorder),howwouldeachofthefollowingalgorithmsplaceprocessesof202K,407K,126K,and416K(inorder)?
(a)First-fit
(b)Best-fit
(c)Next-fit
(d)Worst-fit
4(9pts).
AnOSusesrequestpagingsysteminmemorymanagement.Assumethecapacityofthemainmemoryis300byte,whichisdividedinto3frames.TheprocesswillaccessthefollowingLogicaladdressbyteseries:
215,328,160,68,346,132,368,432,660,and767.
Yourtasksare:
(a)Writingdownthepage-referencestringsequence.
(b)AnalyzethepagereplacementsituationandcalculatethepagefaultfrequencywhenLRUandFIFOalgorithmisused
Section5.Program:
Thereare2questions,intotal10scores.
1.Thereisaplateonthetableanditcouldonlycontainonefruit.DadFrankcouldputtheappleonitandmumJessicacouldputtheorangeonit.Buttheydosuchjobsbymutualexclusion.SonTomfetchestheorangeonlyanddaughterAnnefetchesappleonly.Theydoitbymutualexclusion,too.PleasewritedownFrank,Jessica,TomandAnne’sprogramsbyusingdown-upoperatingcorrectly.
Solution:
Semaphoreempty=
apple=0,orange=0;
ProcessFather()
{
wait(empty);
put_apple;
;
}
ProcessMather()
{
wait(empty);
put_orange;
;
}
ProcessSon()
{
;
get_orange;
signal(empty);
}
ProcessDaughter()
{
;
get_apple;
signal(empty);
}
2.Diningphilosopher(DP)problemisonepopularinstanceofOS’ssynchronizationproblems.HereistheunfinishedpseudocodeforaDPproblemwithfivephilosophers.Pleasecompleteit.
semaphorechopstick[5]={⑥};
semaphorecoord=4;
ProcessPhilosopher(i)
{
while
(1)
{
wait(⑦);
wait(chopstick[i]);
wait(⑧);
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 第二 学期 操作系统 考卷
![提示](https://static.bdocx.com/images/bang_tan.gif)