版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
ModernOperatingSystems
Chapter5–DisksZhangYangSpring2013ContentoftheLecture5.4DisksDiskHardwareMagneticDisksDiskFormattingDiskArmSchedulingAlgorithmErrorHandlingStableStorageMagneticDisks(1)OrganizedintocylindersEachcylinderscontainstrackswhosenumberisequaltothenumberofheadsinthediskdriveEachtrackisdividedintoanumberofsectors.E.g.forfloppydisks,8-32sectors/track.
Thesectorsizeisusually512bytes.ThereareIDE,SCSI,FiberChannel,andSATAharddisks.OnecylinderOnetrackOnesectorMagneticDisks(2)MagneticDisks(3)Figure5-18DiskparametersfortheoriginalIBMPCfloppydiskandaWesternDigitalWD18300harddiskAHardDiskDiskArmArmmotionpathDiskHeadOneplatterMagneticDisks(4)MagneticDisks(5)Figure5-19(a)Physicalgeometryofadiskwithtwozones(b)ApossiblevirtualgeometryforthisdiskMagneticDisks(6)DiskAddressingMillionsofsectorsonthediskmustbelabeledTwopossibilitiesCylinder/head/sector(CHS)Sequentialnumbering(LBA)ModerndrivesusesequentialnumbersDisksmapsequentialnumbersintospecificlocationLogicalBlockAddressingorLBA
MappingmaybemodifiedbythediskRemapbadsectorsOptimizeperformanceHidetheexactgeometry,makinglifesimplerfortheOSMagneticDisks(7)DiskFormatting(1)Aftermanufacturing,thereisnoinformationonthediskJustemptybitsEachplatterneedtohaveAlow-levelformatAhigh-levelformatbeforediskcanbeused.Low-levelFormattingDividingadiskintosectorsthatthediskcontrollercanreadandwrite.Low-levelformattingisusuallydonebyvendorsDiskFormatting(2)Low-LevelFormatting(ctd.)Eachtrackshouldhaveformattedinthefollowingway:Sectorsandinter-sector-gapbetweenthemAsectorwillbehaveformatlikethefollowing:Preamble–data(512bytes)–ChecksumsectorsectorsectorpreambleData(512bytes)ECC(~16bytes)certainbitpatterncylindernumbersectornumberDiskFormatting(3)Low-LevelFormatting(ctd.)CylinderSkewWhenreadingsequentialblocks,theseektimecanresultinmissingblock0inthenexttrack.Diskcanbeformattedusingacylinderskewtoavoidthis.CylinderSkew:Startcylindersatdifferentpointstogivetheheadtimetojumpfromonetothenext.Example:10000rpmdiskdrive,300sectorspertrack,seektime800us,thecylinderskewis40sectors10000rpmDriverotatesin6msTrackhas300sectorsNewsectorevery20µsIftrackseektime800µs40sectorspassonseekDiskFormatting(4)0123456789101112131415161718192021222301234567910111213141516171819202122232401234567891011121314151617181920212223DirectionofrotationSweeppath>timetochangetrack(cyclinder)DiskFormatting(5)Low-LevelFormatting(ctd.)InterleavingIfwehaveONEsectorbufferinthediskcontrollerAfterwehavetransferredonesectorofdatafromhard-disktocontrollerbuffer:WewillcopythecontrollerbuffertothememoryDuringthistime,thedisk-headwillpassthestartofthenextsector.Therefore,thenextlogicalsector,shouldnotbethenextphysicalsectorinhard-disk.Thereshouldbesomeinterleaving.DiskFormatting(6)01234567910111213141516171819202122232401234567891011121314151617181920212223registersregistersCPUMEMORYDiskController1sectorbuffer(1)(2)(3)DiskFormatting(7)Low-LevelFormatting(ctd.)Interleaving(ctd.)(a)Nointerleaving(b)Singleinterleaving(morecommon)Skippingonesectorbetweenreads(c)DoubleinterleavingSkippingtwosectorsbetweenreadsDiskFormatting(8)Low-LevelFormatting(ctd.)Interleaving(ctd.)Moderndrivesovercomeinterleavingtypeissuesbysimplyreadingtheentiretrack(orpartthereof)intotheon-diskcontrollerandcachingit.DiskFormatting(9)DiskPartitioningEachpartitionislikeaseparatediskSector0isMBR
Containsbootcode+partitiontablePartitiontablehasstartingsectorandsizeofeachpartitionHigh-levelformattingDoneforeachpartitionSpecifiesbootblock,freelist,rootdirectory,emptyfilesystemWhathappensonboot?BIOSloadsMBR,bootprogramcheckstoseeactivepartitionReadsbootsectorfromthatpartitionthatthenloadsOSkernel,etcDiskFormatting(10)DiskPartitioning(ctd.)DiskFormatting(11)DiskPartitioning(ctd.)DiskQueues(1)DiskQueues(2)DiskSectorXMem
Ptr0nextentryEntry1SectorYMem
Ptr1nextentryEntry2SectorZMem
Ptr2nextentryEntry3headtailDiskArmScheduling(1)Howlongdoesittaketoreadablock(sector)PositioningTime+TransferTimePositioningTimeSeekTimeMovearmtothecorrectcylinderRotationalDelayWaituntilcorrectsectorcomesunderhead.ActualdatatransfertimeFormostsystems,theseektimedominatestheothertwotimes.DiskArmScheduling(2)Assumethediskisheavilyloaded.Therearealotofrequestsfordiskblocksthatarearrivingtotheharddiskdriver.Thedriversqueuestherequests.Thedriverknowsforeachblockrequest,whereinharddisktheblockshouldbestored(thecylindernumber).Sincemovingbetweencylinders(seektime)iscostly,weshouldtrytominimizetheseseektimes.DiskArmScheduling(3)DiskDriverKeepsatableofrequests.TableisindexedbythecylindernumberBlocksrequestsforthesamecylinderareputinalinkedlist.xxxxx05101520InitialpositionpendingrequestscylindernumberDiskArmSchedulingAlgorithmsFCFS(1)Servetherequestintheordertheyarrive(don’tlooktothecylindernumbers)ExampleAssumethecurrentpositioniscylinder11.Thefollowingrequestsarriveinthegiventimeorder:1,36,16,34,9,12Therequestwillbeservedinthesameorder.Theheadwillgoto:Cylinder1first(10cylindermotion)Cylinder36next(35cylindermotion)Cylinder16next(20)Cylinder34next(18)Cylinder9next(25)Cylinder12next(3)Totalof111cylindersareskipped.Cost=111FCFS(2)xxxxx
xx051015
20253035
Newrequestarrivalsequence:1,36,16,34,9,12Initialheadpositionxxxxx
xx051015
20253035
Newrequestarrivalsequence:1,36,16,34,9,12InitialheadpositionIssueThegoalsofminimalresponsetimeandfairnessareinconflicthere.Examplexxxxx
xx051015
20253035
Newrequestarrivalsequence:1,36,16,34,9,12InitialheadpositionAftergoingto16,anewrequestfor8ispresent,then13.ElevatorAlgorithm(1)AlsocalledSCANalgorithm.Dolikewhatanelevatordoes.1.Moveinonedirectionuntilallrequestinthatdirectionisserved2.Thenchangedirection.3.Moveinthenewdirectionuntilallrequestinthatdirectionareserver.Repeatsteps1,2,and3.InthepreviousexampleAssumeinitialpositionwas11andinitialdirectionwasup(goingtohighernumberedcylinders).ElevatorAlgorithm(2)Therequestareserverinthefollowingorder:12,16,34,36,9,1Armmotions(#ofcylinderskips)1,4,18,2,27,8Totalcost=60cylinders.Performsgoodandisfair.Softwareshouldmaintain1bittoknowthedirection.ElevatoralsoshouldknowwhetheritisgoingUPorDOWNElevatorAlgorithm(3)xxxxx
xx051015
20253035
Newrequestarrivalsequence:1,36,16,34,9,12InitialheadpositionC-SCAN(1)Providesamoreuni
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026福建泉州安溪县凤城中学招聘秋季编外合同教师备考题库及参考答案详解
- 2026内蒙古赤峰市人大常委会办公室所属事业单位竞争性比选人员3人备考题库及1套完整答案详解
- 2026湖州银行嘉兴分行招聘备考题库及完整答案详解1套
- 某纸业厂生产安全制度
- 2026福建泉州安溪县凤城中学招聘秋季编外合同教师备考题库及1套完整答案详解
- 2026华东师范大学附属闵行虹桥学校教师招聘备考题库及1套完整答案详解
- 2026广东广州市增城区朱村街第五幼儿园招聘2人备考题库及1套完整答案详解
- 2026春人教版数学三年级下册期末复习重点必练易错专项练习卷含参考答案
- 2026四川省经济和信息化厅所属事业单位选调8人备考题库及完整答案详解1套
- 2026江苏南京大学艺术学院准聘长聘岗位(事业编制)招聘备考题库含答案详解
- 2026年四川绵阳科技城新区社区工作者招聘考试试卷1(含答案解析)
- 2026广东阳江市事业单位招聘高校毕业生87人考试备考试题及答案解析
- 【2026春】苏科版(新教材)小学信息技术五年级下册《问题规模与算法步骤的执行次数》同步练习及答案
- 2026年安全生产月经典事故警示案例汇编(全行业)
- 2026新疆能源(集团)有限责任公司财务系统人员招聘6人笔试历年参考题库附带答案详解
- 工会主席接待日工作制度
- 2025年江苏省常州市溧阳市小升初数学试卷
- 2026年能源技术基础基础试题库及完整答案详解(必刷)
- 《口腔颌面外科临床诊疗指南(2025版)》
- 2026河南郑州电力职业技术学院2-3月份教师招聘51人笔试模拟试题及答案解析
- AQ 4115-2025 烟花爆竹防止静电危害技术规范
评论
0/150
提交评论