操作系统有责任高效地使用硬件对于磁盘设备_第1页
操作系统有责任高效地使用硬件对于磁盘设备_第2页
操作系统有责任高效地使用硬件对于磁盘设备_第3页
操作系统有责任高效地使用硬件对于磁盘设备_第4页
操作系统有责任高效地使用硬件对于磁盘设备_第5页
已阅读5页,还剩40页未读 继续免费阅读

下载本文档

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

文档简介

Chapter14:Mass-StorageSystemsDiskStructureDiskSchedulingDiskManagementSwap-SpaceManagementRAIDStructureDiskAttachmentStable-StorageImplementationTertiaryStorageDevicesOperatingSystemIssuesPerformanceIssues 1 4/11/第1页DiskStructureDiskdrivesareaddressedaslarge1-dimensionalarraysoflogicalblocks,wherethelogicalblockisthesmallestunitoftransfer.

The1-dimensionalarrayoflogicalblocksismappedintothesectorsofthedisksequentially.Sector0isthefirstsectorofthefirsttrackontheoutermostcylinder.Mappingproceedsinorderthroughthattrack,thentherestofthetracksinthatcylinder,andthenthroughtherestofthecylindersfromoutermosttoinnermost. 2 4/11/第2页DiskSchedulingTheoperatingsystemisresponsibleforusinghardwareefficiently—forthediskdrives,thismeanshavingafastaccesstimeanddiskbandwidth.

操作系统有责任高效地使用硬件——对于磁盘设备,这意味着很短访问时间和磁盘带宽。Accesstimehastwomajorcomponents访问时间包含两个主要部分Seektimeisthetimeforthediskaretomovetheheadstothecylindercontainingthedesiredsector.寻道时间是指把磁头移到所需柱面时间。Rotationallatencyistheadditionaltimewaitingforthedisktorotatethedesiredsectortothediskhead.旋转延迟是指等候磁盘上所需要扇区旋转到磁头下面时间。 3 4/11/第3页DiskSchedulingMinimizeseektime最小寻道时间Seektimeseekdistance寻道时间

寻道距离Diskbandwidthisthetotalnumberofbytestransferred,dividedbythetotaltimebetweenthefirstrequestforserviceandthecompletionofthelasttransfer.

磁盘带宽,是用传输总位数,除以第一个服务请求与最终传输完成之间总时间。 4 4/11/第4页DiskScheduling(Cont.)SeveralalgorithmsexisttoscheduletheservicingofdiskI/Orequests.Weillustratethemwitharequestqueue(0-199).

98,183,37,122,14,124,65,67 Headpointer53 5 4/11/第5页FCFSIllustrationshowstotalheadmovementof640cylinders. 6 4/11/第6页SSTFSelectstherequestwiththeminimumseektimefromthecurrentheadposition.SSTFschedulingisaformofSJFscheduling;maycausestarvationofsomerequests.Illustrationshowstotalheadmovementof236cylinders. 7 4/11/第7页SSTF(Cont.) 8 4/11/第8页SCANThediskarmstartsatoneendofthedisk,andmovestowardtheotherend,servicingrequestsuntilitgetstotheotherendofthedisk,wheretheheadmovementisreversedandservicingcontinues.Sometimescalledtheelevatoralgorithm(电梯算法).Illustrationshowstotalheadmovementof208cylinders. 9 4/11/第9页SCAN(Cont.) 10 4/11/第10页C-SCANProvidesamoreuniformwaittimethanSCAN.Theheadmovesfromoneendofthedisktotheother.servicingrequestsasitgoes.Whenitreachestheotherend,however,itimmediatelyreturnstothebeginningofthedisk,withoutservicinganyrequestsonthereturntrip.Treatsthecylindersasacircularlistthatwrapsaroundfromthelastcylindertothefirstone. 11 4/11/第11页C-SCAN(Cont.) 12 4/11/第12页C-LOOKVersionofC-SCANArmonlygoesasfarasthelastrequestineachdirection,thenreversesdirectionimmediately,withoutfirstgoingallthewaytotheendofthedisk. 13 4/11/第13页C-LOOK(Cont.) 14 4/11/第14页SelectingaDisk-SchedulingAlgorithmSSTFiscommonandhasanaturalappealSCANandC-SCANperformbetterforsystemsthatplaceaheavyloadonthedisk.Performancedependsonthenumberandtypesofrequests.Requestsfordiskservicecanbeinfluencedbythefile-allocationmethod.Thedisk-schedulingalgorithmshouldbewrittenasaseparatemoduleoftheoperatingsystem,allowingittobereplacedwithadifferentalgorithmifnecessary.EitherSSTForLOOKisareasonablechoiceforthedefaultalgorithm. 15 4/11/第15页DiskManagementLow-levelformatting,orphysicalformatting—Dividingadiskintosectorsthatthediskcontrollercanreadandwrite.Touseadisktoholdfiles,theoperatingsystemstillneedstorecorditsowndatastructuresonthedisk.Partitionthediskintooneormoregroupsofcylinders.Logicalformattingor“makingafilesystem”.Bootblockinitializessystem.ThebootstrapisstoredinROM.Bootstraploaderprogram.Methodssuchassectorsparingusedtohandlebadblocks. 16 4/11/第16页MS-DOSDiskLayout 17 4/11/第17页Swap-SpaceManagementSwap-space—Virtualmemoryusesdiskspaceasanextensionofmainmemory.Swap-spacecanbecarvedoutofthenormalfilesystem,or,morecommonly,itcanbeinaseparatediskpartition.Swap-spacemanagement4.3BSDallocatesswapspacewhenprocessstarts;holdstextsegment(theprogram)anddatasegment.Kernelusesswapmapstotrackswap-spaceuse.Solaris2allocatesswapspaceonlywhenapageisforcedoutofphysicalmemory,notwhenthevirtualmemorypageisfirstcreated. 18 4/11/第18页4.3BSDText-SegmentSwapMap 19 4/11/第19页4.3BSDData-SegmentSwapMap 20 4/11/第20页RAIDStructureRAID–multiplediskdrivesprovidesreliabilityviaredundancy.RAIDisarrangedintosixdifferentlevels. 21 4/11/第21页RAID(cont)Severalimprovementsindisk-usetechniquesinvolvetheuseofmultipledisksworkingcooperatively.

Diskstripingusesagroupofdisksasonestorageunit.

RAIDschemesimproveperformanceandimprovethereliabilityofthestoragesystembystoringredundantdata.Mirroringorshadowingkeepsduplicateofeachdisk.Blockinterleavedparityusesmuchlessredundancy. 22 4/11/第22页RAIDLevels 23 4/11/第23页RAID(0+1)and(1+0) 24 4/11/第24页DiskAttachmentDisksmaybeattachedoneoftwoways:HostattachedviaanI/OportNetworkattachedviaanetworkconnection 25 4/11/第25页Network-AttachedStorage 26 4/11/第26页Storage-AreaNetwork 27 4/11/第27页Stable-StorageImplementationWrite-aheadlogschemerequiresstablestorage.

Toimplementstablestorage:Replicateinformationonmorethanonenonvolatilestoragemediawithindependentfailuremodes.Updateinformationinacontrolledmannertoensurethatwecanrecoverthestabledataafteranyfailureduringdatatransferorrecovery. 28 4/11/第28页TertiaryStorageDevicesLowcostisthedefiningcharacteristicoftertiarystorage.

Generally,tertiarystorageisbuiltusingremovablemedia

CommonexamplesofremovablemediaarefloppydisksandCD-ROMs;othertypesareavailable. 29 4/11/第29页RemovableDisksFloppydisk—thinflexiblediskcoatedwithmagneticmaterial,enclosedinaprotectiveplasticcase.

Mostfloppiesholdabout1MB;similartechnologyisusedforremovabledisksthatholdmorethan1GB.Removablemagneticdiskscanbenearlyasfastasharddisks,buttheyareatagreaterriskofdamagefromexposure. 30 4/11/第30页RemovableDisks(Cont.)Amagneto-opticdiskrecordsdataonarigidplattercoatedwithmagneticmaterial.Laserheatisusedtoamplifyalarge,weakmagneticfieldtorecordabit.Laserlightisalsousedtoreaddata(Kerreffect).Themagneto-opticheadfliesmuchfartherfromthedisksurfacethanamagneticdiskhead,andthemagneticmaterialiscoveredwithaprotectivelayerofplasticorglass;resistanttoheadcrashes.

Opticaldisksdonotusemagnetism;theyemployspecialmaterialsthatarealteredbylaserlight. 31 4/11/第31页WORMDisksThedataonread-writediskscanbemodifiedoverandover.WORM(“WriteOnce,ReadManyTimes”)diskscanbewrittenonlyonce.Thinaluminumfilmsandwichedbetweentwoglassorplasticplatters.Towriteabit,thedriveusesalaserlighttoburnasmallholethroughthealuminum;informationcanbedestroyedbynotaltered.Verydurableandreliable.ReadOnlydisks,suchadCD-ROMandDVD,comfromthefactorywiththedatapre-recorded. 32 4/11/第32页TapesComparedtoadisk,atapeislessexpensiveandholdsmoredata,butrandomaccessismuchslower.Tapeisaneconomicalmediumforpurposesthatdonotrequirefastrandomaccess,e.g.,backupcopiesofdiskdata,holdinghugevolumesofdata.Largetapeinstallationstypicallyuserobotictapechangersthatmovetapesbetweentapedrivesandstorageslotsinatapelibrary.stacker–librarythatholdsafewtapessilo–librarythatholdsthousandsoftapesAdisk-residentfilecanbearchivedtotapeforlowcoststorage;thecomputercanstageitbackintodiskstorageforactiveuse. 33 4/11/第33页OperatingSystemIssuesMajorOSjobsaretomanagephysicaldevicesandtopresentavirtualmachineabstractiontoapplications

Forharddisks,theOSprovidestwoabstraction:Rawdevice–anarrayofdatablocks.Filesystem–theOSqueuesandschedulestheinterleavedrequestsfromseveralapplications. 34 4/11/第34页ApplicationInterfaceMostOSshandleremovabledisksalmostexactlylikefixeddisks—anewcartridgeisformattedandanemptyfilesystemisgeneratedonthedisk.Tapesarepresentedasarawstoragemedium,i.e.,andapplicationdoesnotnotopenafileonthetape,itopensthewholetapedriveasarawdevice.Usuallythetapedriveisreservedfortheexclusiveuseofthatapplication.SincetheOSdoesnotprovidefilesystemservices,theapplicationmustdecidehowtousethearrayofblocks.Sinceeveryapplicationmakesupitsownrulesforhowtoorganizeatape,atapefullofdatacangenerallyonlybeusedbytheprogramthatcreatedit. 35 4/11/第35页TapeDrivesThebasicoperationsforatapedrivedifferfromthoseofadiskdrive.locatepositionsthetapetoaspecificlogicalblock,notanentiretrack(correspondstoseek).Thereadpositionoperationreturnsthelogicalblocknumberwherethetapeheadis.Thespaceoperationenablesrelativemotion.Tapedrivesare“append-only”devices;updatingablockinthemiddleofthetapealsoeffectivelyeraseseverythingbeyondthatblock.AnEOTmarkisplacedafterablockthatiswritten. 36 4/11/第36页FileNamingTheissueofnamingfilesonremovablemediaisespeciallydifficultwhenwewanttowritedataonaremovablecartridgeononecomputer,andthenusethecartridgeinanothercomputer.ContemporaryOSsgenerallyleavethenamespaceproblemunsolvedforremovablemedia,anddependonapplicationsanduserstofigureouthowtoaccessandinterpretthedata.Somekindsofremovablemedia(e.g.,CDs)aresowellstandardizedthatallcomputersusethemthesameway. 37 4/11/第37页HierarchicalStorageManagement(HSM)Ahierarchicalstoragesystemextendsthestoragehierarchybeyondprimarymemoryandsecondarystoragetoincorporatetertiarystorage—usuallyimplementedasajukeboxoftapesorremovabledisks.Usuallyincorporatetertiarystoragebyextendingthefilesystem.Smallandfrequentlyusedfilesremainondisk.Large,old,inactivefilesarearchivedtothejukebox.HSMisusuallyfoundinsupercomputingcentersandotherlargeinstallationsthathaveenormousvolumesofdata. 38 4/11/第38页SpeedTwoaspectsofspeedintertiarystoragearebandwidthandlatency.

Bandwidthismeasuredinbytespersecond.Sustainedbandwidth–averagedatarateduringalargetransfer;#ofbytes/transfertime.

Dataratewhenthedatastreamisactuallyflowing.Effectivebandwidth–averageovertheentireI/Otime,includingseekorlocate,andcartridgeswitching.

Drive’soveralldatarate. 39 4/11/第39页Speed(Cont.)Accesslatency–amountoftimeneededtolocatedata.Accesstimeforadisk–movethearmtotheselectedcylinderandwaitfortherotationallatency;<35milliseconds.Accessontaperequireswindingthetapereelsuntiltheselectedblockreachesthetapehead;tensorhundredsofseconds.Generallysaythatrandomaccesswithinatapecartridgeisaboutathousandtimesslowerthanrandomaccessondisk.T

温馨提示

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

评论

0/150

提交评论