您好,欢迎访问三七文档
Chapter11:FileSystemImplementation沈卓炜h@dzwshen@seu.edu.cn四牌楼校区文正楼南205,83790819-802九龙湖校区计算机楼316Chapter11:FileSystemIlttiImplementationFileSstemStrctreFileSystemStructureFileSystemImplementationypDirectoryImplementationAlltiMthdAllocationMethodsFree-SpaceManagementpgEfficiencyandPerformanceRecoveryLog-StructuredFileSystemsSoutheastUniversity11.2OperatingSystemConceptsLogStructuredFileSystemsNFSFile-SystemStructureeSysteStuctueFilestrctreFilestructureLogicalstorageunitCollectionofrelatedinformationFilesystemresidesonsecondarystorageFilesystemresidesonsecondarystorage(disks).Filesystemorganizedintolayers.Filecontrolblock–storagestructureFilecontrolblockstoragestructureconsistingofinformationaboutafile.SoutheastUniversity11.3OperatingSystemConceptsLayeredFileSystemSoutheastUniversity11.4OperatingSystemConceptsATypicalFileControlBlockypcaeCotoocSoutheastUniversity11.5OperatingSystemConceptsIn-MemoryFileSystemStructureseoyeSysteStuctuesThefolloingfigreillstratesthenecessarThefollowingfigureillustratesthenecessaryfilesystemstructuresprovidedbytheoperatingsystems.Figure12-3(a)referstoopeningafile.Figure12-3(b)referstoreadingafileFigure12-3(b)referstoreadingafile.SoutheastUniversity11.6OperatingSystemConceptsIn-MemoryFileSystemStructuresSoutheastUniversity11.7OperatingSystemConceptsSoutheastUniversity11.8OperatingSystemConceptsSoutheastUniversity11.9OperatingSystemConceptsDirectoryImplementationectoypeetatoLinearlistoffilenameswithpointertothedatablocksdatablocks.simpletoprogramtime-consumingtoexecuteHashTable–linearlistwithhashdatastructurestructure.decreasesdirectorysearchtimecollisions–situationswheretwofilenameshashtothesamelocationSoutheastUniversity11.10OperatingSystemConceptsSoutheastUniversity11.11OperatingSystemConceptsAllocationMethodsocatoetodsAnallocationmethodreferstohodiskAnallocationmethodreferstohowdiskblocksareallocatedforfiles:ContiguousallocationContiguousallocationLinkedallocationIndexedallocationSoutheastUniversity11.12OperatingSystemConceptsContiguousAllocationEachfileoccupiesasetofcontiguousblocksonthedisk.Simple–onlystartinglocation(block#)andSimpleonlystartinglocation(block#)andlength(numberofblocks)arerequired.Randomaccess.Wastefulofspace(dynamicstorage-allocationproblem).SoutheastUniversity11.13OperatingSystemConceptsFilescannotgrow.ContiguousAllocationofDiskSpaceSoutheastUniversity11.14OperatingSystemConceptsExtent-BasedSystemstetasedSystesManynewerfilesystems(I.e.VeritasFileSystem)useamodifiedcontiguousSystem)useamodifiedcontiguousallocationscheme.ExtentbasedfilesystemsallocatediskExtent-basedfilesystemsallocatediskblocksinextents.AnextentisacontiguousblockofdisksAnextentisacontiguousblockofdisks.Extentsareallocatedforfileallocation.AfileconsistsofoneormoreextentsSoutheastUniversity11.15OperatingSystemConceptsconsistsofoneormoreextents.LinkedAllocationedocatoEachfileisalinkedlistofdiskblocksblocksEachfileisalinkedlistofdiskblocks:blocksmaybescatteredanywhereonthedisk.pointerblock=SoutheastUniversity11.16OperatingSystemConceptsLinkedAllocation(Cont.)edocato(Cot)Simple–needonlystartingaddressfFree-spacemanagementsystem–nowasteofspacepFilescangrowNorandomaccessEachblockcontainsapointer,wastingspaceBlktthdlbBlocksscattereverywhereandalargenumberofdiskseeksmaybenecessarySoutheastUniversity11.17OperatingSystemConceptsReliability:whatifapointerislostordamaged?LinkedAllocationSoutheastUniversity11.18OperatingSystemConceptsFile-AllocationTableeocatoabeSoutheastUniversity11.19OperatingSystemConceptsIndexedAllocationdeedocatoBringsallpointerstogetherintotheindeblockBringsallpointerstogetherintotheindexblock.Afile’sdirectoryentrycontainsapointertoitsyypindex.Hence,theindexblockofanindexedallocationplaysthesameroleasthepageallocationplaysthesameroleasthepagetable.LiliLogicalview.SoutheastUniversity11.20OperatingSystemConceptsindextableExampleofIndexedAllocationapeodeedocatoSoutheastUniversity11.21OperatingSystemConceptsIndexedAllocation(Cont.)RdRandomaccessTheindexedallocationsuffersfromwastedTheindexedallocationsuffersfromwastedspace.Theindexblockmaynotbefullyused(ieinternalfragmentation)(i.e.,internalfragmentation).Thenumberofentriesofanindextabledeterminesthesizeofafile.Toovercomethisproblem,wecanhavep,multipleindexblocks,chainthemintoalinked-listmultipleindexblocksbutmakethematreejustlikemultipleindexblocks,butmakethematreejustliketheindexedaccessmethodAbitifbthSoutheastUniversity11.22OperatingSystemConceptsAcombinationofbothIndexedAllocation(Cont.)deedocato(Cot)Mouter-indexindextablefileSoutheastUniversity11.23OperatingSystemConceptsCombinedScheme:UNIX(4Kbytesperblock))SoutheastUniversity11.24OperatingSystemConceptsFree-SpaceManagementeeSpaceaageetHowdowekeeptrackfreeblocksonadisk?Howdowekeeptrackfreeblocksonadisk?Afree-listismaintained.Whenanewblockisrequestedwesearchthislisttofindoneisrequested,wesearchthislisttofindone.Thefollowingarecommonlyusedtechniques:techniques:BitVectorLinkedListLinkedListLinkedList+GroupingLin
本文标题:操作系统原理11
链接地址:https://www.777doc.com/doc-5961761 .html