斯坦福大学操作系统期末考试题英文Word文档格式.docx
《斯坦福大学操作系统期末考试题英文Word文档格式.docx》由会员分享,可在线阅读,更多相关《斯坦福大学操作系统期末考试题英文Word文档格式.docx(8页珍藏版)》请在冰豆网上搜索。
2
3
____/10
4
____/14
5
6
____/16
7
8
9
10
Total
____/140
RawScore:
___________/140=____________/100
1)[20Points]Deadlock
Considerthefollowingsnapshotofasystem(P=Process,R=Resource):
Available
RA
RB
RC
RD
MaximumDemand
P0
1
P1
P2
P3
P4
CurrentAllocation
Answerthefollowingquestionsusingbanker’salgorithm:
a)CalculatetheNeedsmatrix:
Needs
b)Isthesysteminasafestate?
Ifso,showasafeorderinwhichtheprocessescanrun.
c)CanarequestofoneinstanceofRAbyProcessP0begrantedsafelyaccordingtoBanker’salgorithm?
2)[20points]LogicalandPhysicalAddressSpaces
TheKiwi™memoryarchitecturedesignteamhasadilemma.Theteamisconsideringseveraldifferentmemoryconfigurationvariationsforanupcomingmachinedesign.Considerthefollowingdesigns(Allmemoryaccessesareintermsofbytes,andallareusingpagingtechniques):
Characteristic
Design1
Design2
Design3
PhysicalMemoryAddressWidth
8bit
16bit
32bit
LogicalAddressWidth
12bit
20bit
24bit
Page/Framesizeinbytes
16bytes
32bytes
64bytes
PageTableType
Single
Double
a)[6points]Foreachdesign,listthemaximumnumberofpageseachprocesscanaccessinlogicaladdressspace.
b)[6points]Foreachdesign,listthemaximumnumberofframesinphysicalmemory.
c)[6points]Fordesign3,iftheoutermostpagetableholds32entries,howmanybitsareneededinthelogicaladdresstorepresenttheouterpagetable?
Howmanybitsareusedforrepresentingtheoffsetwithinapage?
Howmanybitsareneededinthelogicaladdressinordertorepresenttheinnerpagetable?
3)[4+4+2=10points]PageReplacement
Giventhefollowingreferencestring:
021301401234
show
a)Pagefaultsoccurduringtheprocessingofthereferencescheme?
b)Thehitratioisforeachofthefollowingpoliciesinapuredemandpagingsystem?
c)WhatdoyouobservewhenyoumovefromScheme1toScheme2?
Explain.
Scheme1:
FIFOwiththreepagesofmainmemory
Scheme2:
FIFOwithfourpagesofmainmemory
4)[6+4+4=14points]AddressTranslation
Considerasystemwherethevirtualmemorypagesizeis2K(2048bytes),andmainmemoryconsistsof4pageframes.Nowconsideraprocesswhichrequires8pagesofstorage.Atsomepointduringitsexecution,thepagetableisasshownbelow:
Virtualpage
Valid
Physicalpage
No
Yes
6
1.Listthevirtualaddressrangesforeachvirtualpage.
2.Listthevirtualaddressrangesthatwillresultinapagefault.
3.Givethemainmemory(physical)addressesforeachofthefollowingvirtualaddresses(allnumbersdecimal):
(i)8500,(ii)14000,(iii)5000,(iv)2100.
Policy:
__________________________________
5)[20points]FileSystemImplementation
Supposeafilesystemisconstructedusingblocksof8wordseach.Inthissystem,awordhasalengthof4bytes.Thediskpackusedtoholdthefilesystemconsistsof32blocks.Theinitialblock(block0)containsadirectoryentry.Thedirectoryentrycontainsthefilenameofasinglefileinthisfilesystem,andapointertothefirstI-nodeinblock1.TheI-nodestructureisasfollows(word,value):
Permissionword
FileSize
Directblock
Single-indirect
Double-indirect
Thefilecontains16wordsofdata:
thefirstdirectindexpointsatblock31,andtheseconddirectindexpointsatblock29.Blocks4,7,10,and15aremarkedbad.Assumethatfreeblocksareallocatedinlogicalorderstartingwithblock0andthatwriteoperationsmodifythefilesystem1blockatatime.
Whatwillthestateofthesystemlooklikeafter100additionalwordsareappendedtothefile(drawablockdiagramshowingthestructureoftheI-nodeandtheblocksthatareallocated)
6)[16points]DiskScheduling
Diskrequestscomeintothediskdriverforcylinders10,22,20,2,40,6,and38,inthatorder.Assumethatthediskhas100cylinders.
Aseektakes6msecpercylindermoved.Computetheaverageseektimefortherequestsequencegivenabovefor
1.First-come,First-served
2.ShortestSeekTimeFirst(SSTF)
3.LOOK(withthedisk-arminitiallymovingtowardshighernumbercylindersfromlowernumbercylinders)
4.C-SCAN
Inallthecases,thearmisinitiallyatcylinder20.
7)[10points]Security:
PublicKeyEncryption
ConsiderthepublickeyencryptiondefinedbytheRSA(Rivest,Shamir,Adelman)scheme.Assumethatthetwostartingprimesarepandqare3and7respectivelyanddeterminethe(nontrivial)privatekeyandpublickeypairsaccordingtotheRSAscheme.
8)[10Points]Networking:
TCP/IP
ThefollowingflowchartshowstheclientandserverportionsofaTCPcommunicationsession.Fillintheemptybubbles/boxeswiththeappropriatesocketsystemcallnames.
CLIENTSERVER
9)[10points]EnduringPrinciplesinSystemDesign
1.Whenasystemgetscomplexindesignwhatisacommonsolutiontomanagethecomplexity?
Giveanexample.
2.Whenyouexperienceincompatibilitiesbetweensystemmodules,howwillyousolvethisproblem?
3.Whatisacommondatastructureusedtomanage(theslotsfor)nresources?
4.Thedataitemssuchasinodesandfilesaretypicallylocatedinexternalmemorythatissluggishrelativetothelocalmainmemory.Howaretheeffectiveaccesstimesofthesestructuresminimized?
5.Whenatablemaintainingalistofpointersgrowsunmanageablylargehowwillyousolvethisproblemsothat(i)searchtimesofthetableisreasonableand(ii)onlytheregionofinterestinthetableneedtobeinthememory?
10)[10points]NachosOperatingSystems
1.Listthetwomainoperations(methods)thathavethepotentialforresultinginapagefault.
2.Whereistheaddressthatcausedthepagefaultstored?
3.YouincrementedthePCaftereverysystemcallyouimplemented?
Whynotforpagefaultsystemcall?
4.WhatisthepurposeofExec,JoinandExitsystemcalls?
5.Explaintheabovewithanexample.
6.Howwouldyoucontroltheaccesstoasharedresourcebymultiplethreads?