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

下载本文档

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

文档简介

Chapter14:Mass-StorageSystemsDiskStructureDiskSchedulingDiskManagementSwap-SpaceManagementRAIDStructureDiskAttachmentStable-StorageImplementationTertiaryStorageDevicesOperatingSystemIssuesPerformanceIssues

1

7/27/2023DiskStructureDiskdrivesareaddressedaslarge1-dimensionalarraysoflogicalblocks,wherethelogicalblockisthesmallestunitoftransfer.

The1-dimensionalarrayoflogicalblocksismappedintothesectorsofthedisksequentially.Sector0isthefirstsectorofthefirsttrackontheoutermostcylinder.Mappingproceedsinorderthroughthattrack,thentherestofthetracksinthatcylinder,andthenthroughtherestofthecylindersfromoutermosttoinnermost.

2

7/27/2023DiskSchedulingTheoperatingsystemisresponsibleforusinghardwareefficiently—forthediskdrives,thismeanshavingafastaccesstimeanddiskbandwidth.

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

3

7/27/2023DiskSchedulingMinimizeseektime最小寻道时间Seektimeseekdistance寻道时间寻道距离Diskbandwidthisthetotalnumberofbytestransferred,dividedbythetotaltimebetweenthefirstrequestforserviceandthecompletionofthelasttransfer.

磁盘带宽,是用传输的总位数,除以第一个服务请求与最后传输完成之间的总时间。

4

7/27/2023DiskScheduling(Cont.)SeveralalgorithmsexisttoscheduletheservicingofdiskI/Orequests.Weillustratethemwitharequestqueue(0-199).

98,183,37,122,14,124,65,67 Headpointer53

5

7/27/2023FCFSIllustrationshowstotalheadmovementof640cylinders.

6

7/27/2023SSTFSelectstherequestwiththeminimumseektimefromthecurrentheadposition.SSTFschedulingisaformofSJFscheduling;maycausestarvationofsomerequests.Illustrationshowstotalheadmovementof236cylinders.

7

7/27/2023SSTF(Cont.)

8

7/27/2023SCANThediskarmstartsatoneendofthedisk,andmovestowardtheotherend,servicingrequestsuntilitgetstotheotherendofthedisk,wheretheheadmovementisreversedandservicingcontinues.Sometimescalledtheelevatoralgorithm(电梯算法).Illustrationshowstotalheadmovementof208cylinders.

9

7/27/2023SCAN(Cont.)

10

7/27/2023C-SCANProvidesamoreuniformwaittimethanSCAN.Theheadmovesfromoneendofthedisktotheother.servicingrequestsasitgoes.Whenitreachestheotherend,however,itimmediatelyreturnstothebeginningofthedisk,withoutservicinganyrequestsonthereturntrip.Treatsthecylindersasacircularlistthatwrapsaroundfromthelastcylindertothefirstone.

11

7/27/2023C-SCAN(Cont.)

12

7/27/2023C-LOOKVersionofC-SCANArmonlygoesasfarasthelastrequestineachdirection,thenreversesdirectionimmediately,withoutfirstgoingallthewaytotheendofthedisk.

13

7/27/2023C-LOOK(Cont.)

14

7/27/2023SelectingaDisk-SchedulingAlgorithmSSTFiscommonandhasanaturalappealSCANandC-SCANperformbetterforsystemsthatplaceaheavyloadonthedisk.Performancedependsonthenumberandtypesofrequests.Requestsfordiskservicecanbeinfluencedbythefile-allocationmethod.Thedisk-schedulingalgorithmshouldbewrittenasaseparatemoduleoftheoperatingsystem,allowingittobereplacedwithadifferentalgorithmifnecessary.EitherSSTForLOOKisareasonablechoiceforthedefaultalgorithm.

15

7/27/2023DiskManagementLow-levelformatting,orphysicalformatting—Dividingadiskintosectorsthatthediskcontrollercanreadandwrite.Touseadisktoholdfiles,theoperatingsystemstillneedstorecorditsowndatastructuresonthedisk.Partitionthediskintooneormoregroupsofcylinders.Logicalformattingor“makingafilesystem”.Bootblockinitializessystem.ThebootstrapisstoredinROM.Bootstraploaderprogram.Methodssuchassectorsparingusedtohandlebadblocks.

16

7/27/2023MS-DOSDiskLayout

17

7/27/2023Swap-SpaceManagementSwap-space—Virtualmemoryusesdiskspaceasanextensionofmainmemory.Swap-spacecanbecarvedoutofthenormalfilesystem,or,morecommonly,itcanbeinaseparatediskpartition.Swap-spacemanagement4.3BSDallocatesswapspacewhenprocessstarts;holdstextsegment(theprogram)anddatasegment.Kernelusesswapmapstotrackswap-spaceuse.Solaris2allocatesswapspaceonlywhenapageisforcedoutofphysicalmemory,notwhenthevirtualmemorypageisfirstcreated.

18

7/27/20234.3BSDText-SegmentSwapMap

19

7/27/20234.3BSDData-SegmentSwapMap

20

7/27/2023RAIDStructureRAID–multiplediskdrivesprovidesreliabilityviaredundancy.RAIDisarrangedintosixdifferentlevels.

21

7/27/2023RAID(cont)Severalimprovementsindisk-usetechniquesinvolvetheuseofmultipledisksworkingcooperatively.

Diskstripingusesagroupofdisksasonestorageunit.

RAIDschemesimproveperformanceandimprovethereliabilityofthestoragesystembystoringredundantdata.Mirroringorshadowingkeepsduplicateofeachdisk.Blockinterleavedparityusesmuchlessredundancy.

22

7/27/2023RAIDLevels

23

7/27/2023RAID(0+1)and(1+0)

24

7/27/2023DiskAttachmentDisksmaybeattachedoneoftwoways:HostattachedviaanI/OportNetworkattachedviaanetworkconnection

25

7/27/2023Network-AttachedStorage

26

7/27/2023Storage-AreaNetwork

27

7/27/2023Stable-StorageImplementationWrite-aheadlogschemerequiresstablestorage.

Toimplementstablestorage:Replicateinformationonmorethanonenonvolatilestoragemediawithindependentfailuremodes.Updateinformationinacontrolledmannertoensurethatwecanrecoverthestabledataafteranyfailureduringdatatransferorrecovery.

28

7/27/2023TertiaryStorageDevicesLowcostisthedefiningcharacteristicoftertiarystorage.

Generally,tertiarystorageisbuiltusingremovablemedia

CommonexamplesofremovablemediaarefloppydisksandCD-ROMs;othertypesareavailable.

29

7/27/2023RemovableDisksFloppydisk—thinflexiblediskcoatedwithmagneticmaterial,enclosedinaprotectiveplasticcase.

Mostfloppiesholdabout1MB;similartechnologyisusedforremovabledisksthatholdmorethan1GB.Removablemagneticdiskscanbenearlyasfastasharddisks,buttheyareatagreaterriskofdamagefromexposure.

30

7/27/2023RemovableDisks(Cont.)Amagneto-opticdiskrecordsdataonarigidplattercoatedwithmagneticmaterial.Laserheatisusedtoamplifyalarge,weakmagneticfieldtorecordabit.Laserlightisalsousedtoreaddata(Kerreffect).Themagneto-opticheadfliesmuchfartherfromthedisksurfacethanamagneticdiskhead,andthemagneticmaterialiscoveredwithaprotectivelayerofplasticorglass;resistanttoheadcrashes.

Opticaldisksdonotusemagnetism;theyemployspecialmaterialsthatarealteredbylaserlight.

31

7/27/2023WORMDisksThedataonread-writediskscanbemodifiedoverandover.WORM(“WriteOnce,ReadManyTimes”)diskscanbewrittenonlyonce.Thinaluminumfilmsandwichedbetweentwoglassorplasticplatters.Towriteabit,thedriveusesalaserlighttoburnasmallholethroughthealuminum;informationcanbedestroyedbynotaltered.Verydurableandreliable.ReadOnlydisks,suchadCD-ROMandDVD,comfromthefactorywiththedatapre-recorded.

32

7/27/2023TapesComparedtoadisk,atapeislessexpensiveandholdsmoredata,butrandomaccessismuchslower.Tapeisaneconomicalmediumforpurposesthatdonotrequirefastrandomaccess,e.g.,backupcopiesofdiskdata,holdinghugevolumesofdata.Largetapeinstallationstypicallyuserobotictapechangersthatmovetapesbetweentapedrivesandstorageslotsinatapelibrary.stacker–librarythatholdsafewtapessilo–librarythatholdsthousandsoftapesAdisk-residentfilecanbearchivedtotapeforlowcoststorage;thecomputercanstageitbackintodiskstorageforactiveuse.

33

7/27/2023OperatingSystemIssuesMajorOSjobsaretomanagephysicaldevicesandtopresentavirtualmachineabstractiontoapplications

Forharddisks,theOSprovidestwoabstraction:Rawdevice–anarrayofdatablocks.Filesystem–theOSqueuesandschedulestheinterleavedrequestsfromseveralapplications.

34

7/27/2023ApplicationInterfaceMostOSshandleremovabledisksalmostexactlylikefixeddisks—anewcartridgeisformattedandanemptyfilesystemisgeneratedonthedisk.Tapesarepresentedasarawstoragemedium,i.e.,andapplicationdoesnotnotopenafileonthetape,itopensthewholetapedriveasarawdevice.Usuallythetapedriveisreservedfortheexclusiveuseofthatapplication.SincetheOSdoesnotprovidefilesystemservices,theapplicationmustdecidehowtousethearrayofblocks.Sinceeveryapplicationmakesupitsownrulesforhowtoorganizeatape,atapefullofdatacangenerallyonlybeusedbytheprogramthatcreatedit.

35

7/27/2023TapeDrivesThebasicoperationsforatapedrivedifferfromthoseofadiskdrive.locatepositionsthetapetoaspecificlogicalblock,notanentiretrack(correspondstoseek).Thereadpositionoperationreturnsthelogicalblocknumberwherethetapeheadis.Thespaceoperationenablesrelativemotion.Tapedrivesare“append-only”devices;updatingablockinthemiddleofthetapealsoeffectivelyeraseseverythingbeyondthatblock.AnEOTmarkisplacedafterablockthatiswritten.

36

7/27/2023FileNamingTheissueofnamingfilesonremovablemediaisespeciallydifficultwhenwewanttowritedataonaremovablecartridgeononecomputer,andthenusethecartridgeinanothercomputer.ContemporaryOSsgenerallyleavethenamespaceproblemunsolvedforremovablemedia,anddependonapplicationsanduserstofigureouthowtoaccessandinterpretthedata.Somekindsofremovablemedia(e.g.,CDs)aresowellstandardizedthatallcomputersusethemthesameway.

37

7/27/2023HierarchicalStorageManagement(HSM)Ahierarchicalstoragesystemextendsthestoragehierarchybeyondprimarymemoryandsecondarystoragetoincorporatetertiarystorage—usuallyimplementedasajukeboxoftapesorremovabledisks.Usuallyincorporatetertiarystoragebyextendingthefilesystem.Smallandfrequentlyusedfilesremainondisk.Large,old,inactivefilesarearchivedtothejukebox.HSMisusuallyfoundinsupercomputingcentersandotherlargeinstallationsthathaveenormousvolumesofdata.

38

7/27/2023SpeedTwoaspectsofspeedintertiarystoragearebandwidthandlatency.

Bandwidthismeasuredinbytespersecond.Sustainedbandwidth–averagedatarateduringalargetransfer;#ofbytes/transfertime.

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

Drive’soveralldatarate.

39

7/27/2023Speed(Cont.)Accesslatency–amountoftimeneededtolocatedata.Accesstimeforadisk–movethearmtotheselectedcylinderandwaitfortherotationallatency;<35milliseconds.Accessontaperequireswindingthetapereelsuntiltheselectedblockreachesthetapehead;tensorhundredsofseconds.Generallysaythatrandomaccesswithinatapecartridgeisaboutathousandtimesslowerthanrandomaccessondisk.Thelowcostoftertiarystorageisaresultofhavingmanycheapcartridgesshareafewexpensivedrives.Aremovablelibraryisbestdevotedtothestorageofinfrequentlyuseddata,becausethelibrarycanonlysatisfyarelativelysmallnumberofI/Orequestsperhour.

40

7/27/2023ReliabilityAfixeddiskdriveislikelytobemorereliablethanaremovablediskortapedrive.

Anopticalcartridgeislikelytobemorereliablethanamagneticdiskortape.

Aheadcrashinafixedharddiskgenerallydestroysthedata,whereasthefailureofatapedriveoropticaldiskdriveoftenleavesthedatacartridgeunharmed.

41

温馨提示

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

评论

0/150

提交评论