计算机操作系统原理_第1页
计算机操作系统原理_第2页
计算机操作系统原理_第3页
计算机操作系统原理_第4页
计算机操作系统原理_第5页
已阅读5页,还剩37页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Chapter13:Mass-StorageSystems,DiskStructureDiskSchedulingDiskManagementSwap-SpaceManagementTertiaryStorageDevicesOperatingSystemIssuesPerformanceIssues,OperatingSystemConcepts,13.1DiskStructure,Diskdrivesareaddressedaslarge1-dimensionalarraysoflogicalblocks,wherethelogicalblockisthesmallestunitoftransfer.Thesizeoflogicalblockis512bytes,whichcanbechooseadifferentsizewhendoinglow-levelformatting.The1-dimensionalarrayoflogicalblocksismappedintothesectorsofthedisksequentially.Sector0isthefirstsectorofthefirsttrackontheoutermostcylinder.Mappingproceedsinorderthroughthattrack,thentherestofthetracksinthatcylinder,andthenthroughtherestofthecylindersfromoutermosttoinnermost.,OperatingSystemConcepts,13.1DiskStructure(2),Thenumberofsectorspertrackhasbeenincreasingasdisktechnologyimproves,andtheouterzoneofadiskusuallyhasseveralhundredsectorspertrack.Thenumberofcylindersperdiskhasbeenincreasing;largediskhastensofthousandsofcylinders.,OperatingSystemConcepts,13.1DiskStructure(2),Moving-HeadDiskMechanism,OperatingSystemConcepts,13.2DiskScheduling,Operatingsystemisresponsibleforusinghardwareefficientlyforthediskdrives,thismeanshavingafastaccesstimeanddiskbandwidth.Accesstime-hastwomajorcomponentsSeektime-thetimeforthediskarmtomovetheheadstothecylindercontainingthedesiredsector.Rotationallatency-theadditionaltimewaitingforthedisktorotatethedesiredsectortothediskhead.Diskbandwidth-thetotalnumberofbytestransferred,dividedbythetotaltimebetweenthefirstrequestforserviceandthecompletionofthelasttransfer.,OperatingSystemConcepts,13.2DiskScheduling(1),ByschedulingtheserviceofdiskI/Orequestsinagoodorder,wecanminimizeseektime.SeektimeseekdistanceSeveralalgorithmsexisttoscheduletheservicingofdiskI/Orequests.Weillustratethemwitharequestqueue(0-199).98,183,37,122,14,124,65,67Headpointer53,OperatingSystemConcepts,13.2.1FCFSScheduling,FCFSthesimplestoneandisintrinsicallyfair,butgenerallydoesnotprovidethefastestservice.Illustrationshowstotalheadmovementof640cylinders.,OperatingSystemConcepts,13.2.2SSTFScheduling,SSTF(shortest-seek-time-first)-Selectstherequestwiththeminimumseektimefromthecurrentheadposition.SSTFschedulingisaformofSJFscheduling;maycausestarvationofsomerequests.SSTFalgorithmisasubstantialimprovementovertheFCFS,butitisnotoptimal.illustrationshowsatotalheadmovementofonly236cylinders(208ispossible?)littlemorethanone-thirdofthedistanceneededforFCFSschedulingofthisrequestqueue.,OperatingSystemConcepts,OperatingSystemConcepts,13.2.2SSTFScheduling(1),13.2.3SCANScheduling,SCAN-diskarmstartsatoneendofthedisk,andmovestowardtheotherend,servicingrequestsalongthewayuntilitgetstotheotherendofthedisk,wheretheheadmovementisreversedandservicingcontinues.Sometimescalledelevatoralgorithm,sincediskarmbehavesjustlikeanelevatorinabuilding,firstservingalltherequestsgoingup,andthenreversingtoservicerequeststheotherway.WithSCAN,needtoknowthedirectionofheadmovement,inadditiontotheheadscurrentposition.Illustrationshowsatotalheadmovementof236cylinders.,OperatingSystemConcepts,13.2.3SCANScheduling(1),Assumethediskarmismovingtoward0.,OperatingSystemConcepts,13.2.4C-SCANScheduling,C-SCAN(CircularSCAN)isavariantofSCANdesignedtoprovideamoreuniformwaittimethanSCAN.C-SCAN-headmovesfromoneendofthedisktotheother,servicingrequestsasitgoes.Whenreachingtheotherend,however,itreturnstothebeginningofthediskimmediately,withoutservicinganyrequestsonthereturntrip.Treatsthecylindersasacircularlistthatwrapsaroundfromthelastcylindertothefirstone.,uniformn.制服adj.统一的,相同的,一致的,始终如一的,均衡的vt.使成一样,使穿制服,OperatingSystemConcepts,OperatingSystemConcepts,13.2.4C-SCANScheduling(1),13.2.5C-LOOKScheduling,C-LOOKisaversionofC-SCAN(alsoLookisversionofSCAN),becauseitlookforarequestbeforecontinuingtomoveinagivendirection.C-LOOK-Armonlygoesasfarasthelastrequestineachdirection,thenreversesdirectionimmediately,withoutgoingallthewaytotheendofthedisk.,OperatingSystemConcepts,OperatingSystemConcepts,13.2.5C-LOOKScheduling(1),13.2.6SelectingaDisk-SchedulingAlgorithm,SSTFiscommonandhasanaturalappeal.SCANandC-SCANperformbetterforsystemsthatplaceaheavyloadonthedisk-lesslikelyhaveastarvationproblem.Performancedependsheavilyonthenumberandtypesofrequestswithanyschedulingalgorithms.Requestsfordiskservicecanbeinfluencedbythefile-allocationmethod(contiguous,linkedorindexed).Thedisk-schedulingalgorithmshouldbewrittenasaseparatemoduleoftheoperatingsystem,allowingittobereplacedwithadifferentalgorithmifnecessary.EitherSSTForLOOKisareasonablechoiceforthedefaultalgorithm.,OperatingSystemConcepts,13.3DiskManagement,Operatingsystemisresponsibleforseveralotheraspectsofdiskmanagement,too.SuchasDiskinitializationBootingfromdiskBad-blockrecovery,OperatingSystemConcepts,13.3.1DiskFormatting,Low-levelformatting(physicalformatting)divideadiskintosectorsthatthediskcontrollercanreadandwrite.fillsthediskwithaspecialdatastructureforeachsector,typicallyconsistingofaheader,adataareaandatrailer.Mostharddisksarelow-levelformattedatthefactoryasapartofthemanufacturingprocess.Touseadisktoholdfiles,operatingsystemstillneedstorecorditsowndatastructuresonthedisk.First,partitiondiskintooneormoregroupsofcylinders.Second,Logicalformattingor“makingafilesystem”.Thesedatastructuresmayincludemapsoffreeandallocatedspace(aFATorinodes)andaninitialemptydirectory.,OperatingSystemConcepts,13.3.2BootBlock,Bootstrapaprogramusedtoinitializeallaspectsofthesystem,fromCPUregisterstodevicecontrollersandthecontentsofmainmemory,andthenstartsOS.Todoitsjob,bootstrapfindstheOSkernelondisk,loadsthatkernelintomemory,andjumpstoaninitialaddresstobegintheoperatingsystemexecution.Formostcomputers,bootstrapisstoredinROM,butnoteasytomodify.So,mostsystemsstoreatinybootstraploaderprograminthebootROM,whoseonlyjobistobringinafullbootstrapprogramformdisk.Thefullbootstrapisstoredinbootblock.BootBlocktheblockusedtostorethefullbootstrap,whichisatafixedlocationonthedisk.Adiskhavingabootpartitioniscalledbootdiskorsystemdisk.,OperatingSystemConcepts,13.3.2BootBlock(1),MS-DOSDiskLayoutusesone512-byteblockforitsbootprogram,OperatingSystemConcepts,13.3.3BadBlocks,Frequently,diskshaveoneormoresectorstobecomedefective,andevencomfromthefactorywithbadblocks.Dependingondiskandcontrollerinuse,badblocksarehandledinavarietyofways.Onsimpledisks,suchasdiskswithIDEcontrollers,badblocksarehandledmanually.(formatcommand)Moresophisticateddisks,suchasSCSIdisksusedinhigh-endPCsandmostworkstationsandservers,aresmarteraboutbad-blockrecovery.controllermaintainsalistofbadblocksondisk,whichisinitializedduringlow-levelformatandisupdatedoverthelifeofdisk.Low-levelformattingalsosetsasidesparesectorsnotvisibletoOS.Controllercanbetoldtoreplaceeachbadsectorlogicallywithoneofthesparesectors.Thisschemeisknownassectorsparing.Somecontrollerscanbeinstructedtoreplaceabadblockbysectorslippinginsteadofsectorsparing.,OperatingSystemConcepts,13.4Swap-SpaceManagement,Swap-spaceVirtualmemoryusesdiskspaceasanextensionofmainmemory.Maingoal-toprovidethebestthroughputforthevirtual-memorysystem.SwapspaceisusedinvariouswaysbydifferentOS,dependingonthememory-managementalgorithmsused.Systemswithswappingmayuseswapspacetoholdtheentireprocessimage,includingcodeanddatasegments.Pagingsystemsmaysimplystorepagesthathavebeenpushedoutofmemory.Theamountofswapspaceneededcanvarydependingontheamountofphysicalmemory,theamountofvirtualmemoryitisbacking,andthewayinwhichvirtualmemoryisused.SomeOS,suchasUNIX,allowtheuseofmultipleswapspaceswhichusuallyputonseparatedisks.,OperatingSystemConcepts,13.4Swap-SpaceManagement(1),Swap-spacecanresideintwoplaces:Canbecarvedoutofthenormalfilesystem.Infact,itssimplyalargefilewithinfilesystem,soitiseasytoimplement,butitisinefficient.Morecommonly,beinaseparatediskpartitionwithoutfilesystemordirectorystructure.Aseparatemanagerisusedtoallocateanddeallocatetheblocks.Needtocreateafixedamountofswapspaceduringdiskpartitioning.Addingmoreswapspacecanbedoneonlyviarepartitioningofdisk,orviaaddinganotherswapspaceelsewhere.Swap-spacemanagement4.3BSDallocatesswapspacewhenprocessstartstoholdtextsegment(theprogram)anddatasegment.Kernelusestwoswapmapstotrackswap-spaceuse.Solaris2allocatesswapspaceonlywhenapageisforcedoutofphysicalmemory,notwhenvirtualmemorypageisfirstcreated.,OperatingSystemConcepts,13.4Swap-SpaceManagement(2),4.3BSDText-SegmentSwapMaptextsegmentisafixedsize,soitsswapspaceisallocatedin512KBchunks,exceptforthefinalchunk.,OperatingSystemConcepts,13.4Swap-SpaceManagement(3),4.3BSDData-SegmentSwapMapasdatasegmentcangrowovertime,themapisoffixedsize,butcontainsswapaddressesforblocksofvaryingsize.,OperatingSystemConcepts,13.5TertiaryStorageDevices,Lowcostisthedefiningcharacteristicoftertiarystorage.Generally,tertiarystorageisbuiltusingremovablemedia.ThemostcommonexamplesofremovablemediaarefloppydisksandCD-ROMs;othertypesareavailable.,OperatingSystemConcepts,13.5.1RemovableDisks,Floppydiskmadefromathinflexiblediskcoatedwithmagneticmaterial,enclosedinaprotectiveplasticcase.Mostfloppiesholdabout1MB;similartechnologyisusedforremovabledisksthatholdmorethan1GB.Removablemagneticdiskscanbenearlyasfastasharddisks,buttheyareatagreaterriskofdamagefromexposureeasytobescratched.,OperatingSystemConcepts,13.5.1RemovableDisks(1),magnetic-opticdisk-recordsdataonarigidplattercoatedwithmagneticmaterial,butrecordingtechnologyisquitedifferentfromthatformagneticdisk.Laserheatisusedtoamplifyalarge,weakmagneticfieldtorecordabit.Laserlightisalsousedtoreaddata(Kerreffect).Themagneto-opticheadfliesmuchfartherfromthedisksurfacethanamagneticdiskhead,andthemagneticmaterialiscoveredwithaprotectivelayerofplasticorglass;thismakesdiskmuchmoreresistanttoheadcrashes.Opticaldisk-donotusemagnetismatall;theyemployspecialmaterialsthatarealteredbylaserlight.Phase-changediskisoneexampleofoptical-disktechnology.Itiscoatedwithamaterialthatcanbefreezeintoeitheracrystallineoranamorphousstate.(re-recordableCD-RWandDVD-RW),OperatingSystemConcepts,13.5.1RemovableDisks(2),Read-writedisks-dataonread-writediskscanbemodifiedoverandover,suchasdisksdescribedabove.WORM(WriteOnce,ReadManyTimes)disks-canbewrittenonlyonce.Thinaluminumfilmsandwichedbetweentwoglassorplasticplatters.Towriteabit,driveusesalaserlighttoburnasmallholethroughthealuminum;informationcanbedestroyedbynotaltered.Verydurableandreliable.ReadOnlydisks-suchasCD-ROMandDVD,comefromthefactorywiththedatapre-recorded.TheyusetechnologysimilartothatofWORMdisks(althoughthepitsarepressed,notburnt),andtheyareverydurable.Mostremovabledisksareslowerthantheirnon-removablecounterparts.Thewritingprocessisslower,asarerotationandsometimesseektime.,OperatingSystemConcepts,13.5.2Tapes,Comparedtoadisk,atapeislessexpensiveandholdsmoredata,butrandomaccessismuchslower.Tapeisaneconomicalmediumforpurposesthatdonotrequirefastrandomaccess,e.g.,backupcopiesofdiskdata,holdinghugevolumesofdata.Largetapeinstallationstypicallyuserobotictapechangersthatmovetapesbetweentapedrivesandstorageslotsinatapelibrary.stackerlibrarythatholdsafewtapessilolibrarythatholdsthousandsoftapesAdisk-residentfilecanbearchivedtotapeforlowcoststorage;thecomputercanstageitbackintodiskstorageforactiveuse.,OperatingSystemConcepts,13.5.3OperatingSystemIssues,Majorjobsofoperatingsystemaretomanagephysicaldevicesandtopresentavirtualmachineabstractiontoapplications.Forharddisks,theoperatingsystemprovidestwoabstractions:Rawdevicejustanarrayofdatablocks.FilesystemtheOSqueuesandschedulestheinterleavedrequestsfromseveralapplications.,OperatingSystemConcepts,13.5.3.1ApplicationInterface,MostOSscanhandleremovabledisksalmostexactlylikefixeddisksanewcartridgemustbeformattedandthenanemptyfilesystemisgeneratedondisk.Tapesarepresentedasarawstoragemedium,i.e.,andapplicationdoesnotopenafileonthetape,itopensthewholetapedriveasarawdevice.Usuallythetapedriveisreservedfortheexclusiveuseofthatapplicationuntilitexitsorclosethetapdrive.SincetheOSdoesnotprovidefilesystemservices,theapplicationmustdecidehowtousethearrayofblocks.Sinceeveryapplicationmakesupitsownrulesforhowtoorganizeatape,atapefullofdatacangenerallyonlybeusedbytheprogramthatcreatedit.,OperatingSystemConcepts,13.5.3.1ApplicationInterface(1),Thebasicoperationsforatapedrivedifferfromthoseofadiskdrive.locatepositionsthetapetoaspecificlogicalblock,notanentiretrack(correspondstoseek).Thereadpositionoperationreturnsthelogicalblocknumberwherethetapeheadis.Thespaceoperationenablesrelativemotion.Tapedrivesare“append-only”devices;updatingablockinthemiddleoftapealsoeffectivelyeraseseverythingbeyondthatblock.AnEOTmarkisplacedafterablockthatiswritten.,OperatingSystemConcepts,13.5.3.2FileNaming,Theissueofnamingfilesonremovablemediaisespeciallydifficultwhenwewanttowritedataonaremovablecartridgeononecomputer,andthenusethecartridgeinanothercomputer.ContemporaryOSsgenerallyleavethenamespaceproblemunsolvedforremovablemedia,anddependonapplicationsanduserstofigureouthowtoaccessandinterpretthedata.Somekindsofremovablemedia(e.g.,CDs)aresowellstandardizedthatallcomputersusethemthesameway.DVDformatsarealsowellstandardized.,OperatingSystemConcepts,13.5.3.3HierarchicalStorageManagement(HSM),Ahierarchicalstoragesystemextendsthestoragehierarchybeyondprimarymemoryandsecondarystoragetoincorporatetertiarystorageusuallyimplementedasajukeboxoftapesorremovabledisks.Usuallyincorporatetertiarystoragebyextendingthefilesystem.Smallandfrequentlyusedfilesremainondisk.Large,old,inactivefilesarearchivedtothejukebox.HSMisusuallyfoundinsupercomputingcentersandotherlargeinstallationsthathaveenormousvolumesofdata.,Jukebox(自动)光盘机,点播机,自动电唱计,小型盒式盘带设备,Installation安装;装备置,设备;计算站中心,OperatingSystemConcepts,13.5.4PerformanceIssues,Aswithanycomponentofoperatingsystem,thethreemostimportaspectsoftertiary-storageperformancearespeed,reliability,andcost.Speedoftertiarystoragehastwoaspects-bandwidthandlatency.Bandwidth-measuredinbytespersecond.Sustainedbandwidthaveragedatarateduringalargetransfer(numberofbytes/transfertime).Dataratewhenthedatastreamisactuallyflowing.EffectivebandwidthaverageovertheentireI/Otime,includingseekorlocate,andcartridgeswitching.itsthedrivesoveralldatarate.,-Speed,Operating

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论