版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
OperatingSystemsChapter12FileManagement2Agenda12.1Overview12.2FileOrganizationandAccess12.3FileDirectories12.4FileSharing12.5RecordBlocking12.6SecondaryStorageManagement12.7Summary3FileManagementFilemanagementsystemconsistsofsystemutilityprogramsthatrunasprivilegedapplications(特權(quán)程序)ProvidesameansofdataI/OInputtoapplicationsisbymeansofafileOutputissavedinafileforlong-termstorage4FileSystemProperties(文件系統(tǒng)的特性)Long-termexistence(長期存在)Sharablebetweenprocesses(進(jìn)程共享)Structure(結(jié)構(gòu)化存儲)Havespecificstructureaccordingtoapplication5FileOperations(文件操作)CreateDeleteOpenCloseReadWrite6TermsUsedwithFiles(文件術(shù)語)Field(域)Basicelementofdata(基本數(shù)據(jù)單元)ContainsasinglevalueCharacterizedbyitslengthanddatatypeRecord(記錄)Collectionofrelatedfields(相關(guān)域的集合)TreatedasaunitExample:employeerecord7TermsUsedwithFilesFile(文件)CollectionofsimilarrecordsTreatedasasingleentityHavefilenamesMayrestrictaccessDatabase(數(shù)據(jù)庫)CollectionofrelateddataRelationshipsexistamongelements8FileManagementSystems(文件管理系統(tǒng))Thewayauserofapplicationmayaccessfiles(用戶和程序使用文件的唯一方式)Programmerdoesnotneedtodevelopfilemanagementsoftware9FileManagementFunctionsIdentify(標(biāo)識)andlocate(定位)aselectedfileUsefilenametoidentifyfilesUseadirectory(目錄)todescribethelocationofallfilesplustheirattributes(屬性)Onasharedsystemdescribeuseraccesscontrol(存取控制)Blocking(塊化)foraccesstofilesManagefreeblocksAllocatefreeblockstofiles(空閑塊分配)Reclaimfreeblocks(空閑塊回收)10Agenda12.1Overview12.2FileOrganizationandAccess12.3FileDirectories12.4FileSharing12.5RecordBlocking12.6SecondaryStorageManagement12.7Summary1112.2FileOrganizationandAccess12.2.1CriteriaforFileOrganization12.2.2ThePile12.2.3TheSequentialFile12.2.4TheIndexedSequentialFile12.2.5TheIndexedFile12.2.6TheDirectorHashedFile12CriteriaforFileOrganization(文件管理的評價標(biāo)準(zhǔn))Shortaccesstime(短的存取時間)Easeofupdate(易于修改)Economyofstorage(存儲經(jīng)濟性)Simplemaintenance(維護簡單)Reliability(可靠性)1312.2FileOrganizationandAccess12.2.1CriteriaforFileOrganization12.2.2ThePile12.2.3TheSequentialFile12.2.4TheIndexedSequentialFile12.2.5TheIndexedFile12.2.6TheDirectorHashedFile14ThePile(堆文件)ThePileDataarecollectedintheordertheyarrivePurposeistoaccumulateamassofdataandsaveitRecordsmayhavedifferentfieldsNostructureRecordaccessisbyexhaustivesearch(窮舉搜索)15ThePile1612.2FileOrganizationandAccess12.2.1CriteriaforFileOrganization12.2.2ThePile12.2.3TheSequentialFile12.2.4TheIndexedSequentialFile12.2.5TheIndexedFile12.2.6TheDirectorHashedFile17TheSequentialFile(順序文件)Allfieldsthesame(orderandlength)FieldnamesandlengthsareattributesofthefileAllrecordsthesamelengthOnefieldisthekeyfiled(關(guān)鍵域,關(guān)鍵字)UniquelyidentifiestherecordRecordsarestoredinkeysequence18TheSequentialFileNewrecordsareplacedinalogfile(日志文件)ortransactionfile(事務(wù)文件)Batchupdate(成批更新)isperformedtomerge(合并)thelogfilewiththemasterfile19TheSequentialFile2012.2FileOrganizationandAccess12.2.1CriteriaforFileOrganization12.2.2ThePile12.2.3TheSequentialFile12.2.4TheIndexedSequentialFile12.2.5TheIndexedFile12.2.6TheDirectorHashedFile21TheIndexedSequentialFile(索引順序文件)Sequentialfile+index+overflowfileIndexprovidesalookupcapabilitytoquicklyreachthevicinityofthedesiredrecord(索引提供了快速接近目標(biāo)記錄的查詢能力)IndexcontainsakeyfieldandapointertothemainfileIndexedissearchedtofindhighestkeyvaluethatisequaltoorprecedesthedesiredkeyvalue(索引查找關(guān)鍵字小于或者等于目標(biāo)關(guān)鍵字的最大記錄)22TheIndexedSequentialFile(索引順序文件)ComparisonofsequentialandindexedsequentialExample:afilecontains1000000recordsOnaverage500000accessesarerequiredtofindarecordinasequentialfileIfanindexcontains1000entriesandeachentriescontains1000pointerstomainfile,itwilltakeonaverage500accessestofindthekey,followedby500accessesinthemainfile.Nowonaverageitis1000accesses23OverflowFileofTheIndexedSequentialFileNewrecordsareaddedtoanoverflowfile(溢出文件)RecordinmainfilethatprecedesitisupdatedtocontainapointertothenewrecordTheoverflowismerged(合并)withthemainfileduringabatchupdateMultiplelevelindexes(多級索引)forthesamekeyfieldcanbesetuptoincreaseefficiency24IndexedSequentialFile2512.2FileOrganizationandAccess12.2.1CriteriaforFileOrganization12.2.2ThePile12.2.3TheSequentialFile12.2.4TheIndexedSequentialFile12.2.5TheIndexedFile12.2.6TheDirectorHashedFile26TheIndexedFile(索引文件)UsesmultipleindexesfordifferentkeyfieldsMaycontainanexhaustiveindex(完全索引)thatcontainsoneentryforeveryrecordinthemainfileMaycontainapartialindex(部分索引)Indexfilesitselfaresequentialfile27
TheIndexedFile2812.2FileOrganizationandAccess12.2.1CriteriaforFileOrganization12.2.2ThePile12.2.3TheSequentialFile12.2.4TheIndexedSequentialFile12.2.5TheIndexedFile12.2.6TheDirectorHashedFile29TheDirectorHashedFile(直接文件或者散列文件)DirectlyaccessablockataknownaddressKeyfieldrequiredforeachrecordHashbasedonthekeyfield30Agenda12.1Overview12.2FileOrganizationandAccess12.3FileDirectories12.4FileSharing12.5RecordBlocking12.6SecondaryStorageManagement12.7Summary3112.3FileDirectories12.3.1Contents12.3.2Structure12.3.3Naming32FileDirectoriesContainsinformationaboutfilesAttributes(屬性)Location(位置)Ownership(所有者)Directoryitselfisafileownedbytheoperatingsystem(一個目錄本身是一個文件)Providesmappingbetweenfilenamesandthefilesthemselves(提供文件名和文件之間的映射)3312.3FileDirectories12.3.1Contents12.3.2Structure12.3.3Naming34SimpleStructureforaDirectory(簡單目錄結(jié)構(gòu))Representedbyasimplesequentialfilewiththenameofthefileservingasthekey(用順序文件代表目錄,該目錄下的文件名做該順序文件的關(guān)鍵字)Forcesusertobecarefulnottousethesamenamefortwodifferentfiles(文件不能重名)35Two-levelSchemeforaDirectory(兩級目錄方案)Amasterdirectory(主目錄)Onedirectoryforeachuser(用戶目錄)MasterdirectorycontainsentryforeachuserProvidesaddressandaccesscontrolinformationEachuserdirectoryisasimplelistoffilesforthatuserStillprovidesnohelpinstructuringcollectionsoffiles(不能建子目錄)36Hierarchical,orTree-StructuredDirectory(層次/樹狀結(jié)構(gòu)目錄)MasterdirectorywithuserdirectoriesunderneathitEachuserdirectorymayhavesubdirectoriesandfilesasentries373812.3FileDirectories12.3.1Contents12.3.2Structure12.3.3Naming39Hierarchical,orTree-StructuredDirectoryFilescanbelocated(文件定位)byfollowingapathfromtheroot,ormaster,directorydownvariousbranchesThisisthepathnameforthefileCanhaveseveralfileswiththesamefilename(文件同名)aslongastheyhaveuniquepathnames4041Hierarchical,orTree-StructuredDirectoryPathname(路徑名)Currentdirectoryistheworkingdirectory(工作目錄)Filesarereferencedrelativetotheworkingdirectory(相對路徑)42Agenda12.1Overview12.2FileOrganizationandAccess12.3FileDirectories12.4FileSharing12.5RecordBlocking12.6SecondaryStorageManagement12.7Summary43FileSharingInmultiusersystem,allowfilestobesharedamongusersTwoissuesAccessrights(存取權(quán)限)Managementofsimultaneousaccess(同時存取控制)44AccessRightsNone(無)UsermaynotknowoftheexistenceofthefileUserisnotallowedtoreadtheuserdirectorythatincludesthefileKnowledge(知道)Usercanonlydeterminethatthefileexistsandwhoitsowneris45AccessRightsExecution(執(zhí)行)TheusercanloadandexecuteaprogrambutcannotcopyitReading(讀)Theusercanreadthefileforanypurpose,includingcopyingandexecutionAppending(追加)Theusercanadddatatothefilebutcannotmodifyordeleteanyofthefile’scontents46AccessRightsUpdating(更新)Theusercanmodify,deleted,andaddtothefile’sdata.Thisincludescreatingthefile,rewritingit,andremovingallorpartofthedataChangingprotection(更改保護)UsercanchangeaccessrightsgrantedtootherusersDeletion(刪除)Usercandeletethefile47AccessRightsOwners(所有者)HasallrightspreviouslylistedMaygrantrightstoothersusingthefollowingclassesofusersSpecificuser(指定用戶)Usergroups(用戶組)Allforpublicfiles(所有用戶)48SimultaneousAccess(同時訪問)UsermaylockentirefilewhenitistobeupdatedUsermaylocktheindividualrecordsduringtheupdateMutualexclusionanddeadlockareissuesforsharedaccess49Agenda12.1Overview12.2FileOrganizationandAccess12.3FileDirectories12.4FileSharing12.5RecordBlocking12.6SecondaryStorageManagement12.7Summary50FixedBlocking51Variable-LengthSpannedBlocking52Variable-LengthUnspannedBlocking53Agenda12.1Overview12.2FileOrganizationandAccess12.3FileDirectories12.4FileSharing12.5RecordBlocking12.6SecondaryStorageManagement12.7Summary5412.6SecondaryStorageManagement(二級存儲管理)12.6.1FileAllocation12.6.2FreeSpaceManagement12.6.3Reliability55FileAllocationTable(FAT)FATisusedtotrackportionsallocatedtofiles56Preallocation(預(yù)分配)VSDynamicallocation(動態(tài)分配)PreallocationNeedthemaximumsizeforthefileatthetimeofcreationDifficulttoreliablyestimatethemaximumpotentialsizeofthefileDynamicallocationAllocatesspacetoafileinportionsasneeded.57Contiguousallocation(連續(xù)分配)Singlesetofblocksisallocatedtoafileatthetimeofcreation(文件創(chuàng)建時分配一組連續(xù)的塊)OnlyasingleentryinthefileallocationtableStartingblockandlengthofthefileExternalfragmentationwilloccurNeedtoperformcompaction58Contiguousallocation59Contiguousallocation60Chainedallocation(鏈?zhǔn)椒峙?Allocationonbasisofindividualblock(基于單個塊進(jìn)行分配)EachblockcontainsapointertothenextblockinthechainOnlysingleentryinthefileallocationtableStartingblockandlengthoffileNoexternalfragmentationBestforsequentialfiles(適合順序文件)Noaccommodationoftheprincipleoflocality(局部性原理不再適用),soconsolidation(遷移、集結(jié))isneedtomoveblocksadjacenteachother61Chainedallocation62Chainedall
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年小學(xué)三年級語文工作計劃(二篇)
- 2024年大學(xué)輔導(dǎo)員新學(xué)期工作計劃(五篇)
- 2024年工勞動合同例文(二篇)
- 2024年南京市區(qū)房屋租賃合同樣本(二篇)
- 農(nóng)小蜂-中國香蕉市場動態(tài)監(jiān)測(2024年9月)
- 2024年安全生產(chǎn)“三同時”管理制度模版(三篇)
- 2024年培訓(xùn)期間的安全管理制度(四篇)
- 2024年導(dǎo)游個人年終工作總結(jié)參考范文(二篇)
- 2024年縣機關(guān)大院環(huán)境衛(wèi)生管理制度例文(五篇)
- 2024年廠區(qū)交通安全管理制度范本(二篇)
- 中職班主任培訓(xùn)課件
- 優(yōu)生優(yōu)育指導(dǎo)工作
- 預(yù)防母嬰傳播
- 水泥的營銷方案和策略
- 《實名認(rèn)證》課件
- 健康關(guān)愛女性知識講座
- 課地球公轉(zhuǎn)與四季變化
- 公司業(yè)績提成方案
- 高效數(shù)據(jù)標(biāo)注流程
- 2024年物流配送行業(yè)無人機配送方案
- 全球海盜史:從維京人到索馬里海盜
評論
0/150
提交評論