第二学期操作系统考卷Word格式.docx
《第二学期操作系统考卷Word格式.docx》由会员分享,可在线阅读,更多相关《第二学期操作系统考卷Word格式.docx(9页珍藏版)》请在冰豆网上搜索。
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
/
1
6
2
3
8
4
9
5
7
Filename
Firstblock
wise
star
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
120
600
2100
18
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
P1
P2
P3
P4
P5
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);
I2(20ms)
J2:
I1(20ms);
CPU(20ms);
I2(40ms)
J3:
CPU(30ms);
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.
(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()
{
put_orange;
ProcessSon()
get_orange;
signal(empty);
ProcessDaughter()
;
get_apple;
2.Diningphilosopher(DP)problemisonepopularinstanceofOS’ssynchronizationproblems.HereistheunfinishedpseudocodeforaDPproblemwithfivephilosophers.Pleasecompleteit.
semaphorechopstick[5]={⑥};
semaphorecoord=4;
ProcessPhilosopher(i)
while
(1)
wait(⑦);
wait(chopstick[i]);
wait(⑧);