培訓(xùn)第二天文件系統(tǒng)接口_第1頁
培訓(xùn)第二天文件系統(tǒng)接口_第2頁
培訓(xùn)第二天文件系統(tǒng)接口_第3頁
培訓(xùn)第二天文件系統(tǒng)接口_第4頁
培訓(xùn)第二天文件系統(tǒng)接口_第5頁
已閱讀5頁,還剩25頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

OperatingSystemConceptsChapter11:File-SystemInterface(文件系統(tǒng)接口)FileConcept

文件概念A(yù)ccessMethods

存取方法DirectoryStructure

目錄結(jié)構(gòu)FileSystemMounting

文件系統(tǒng)安裝FileSharing

文件共享Protection

保護(hù)OperatingSystemConceptsFileConcept(文件概念)Contiguouslogicaladdressspace

相鄰的邏輯地址空間Types:DatanumericcharacterbinaryProgramOperatingSystemConceptsFileStructure(文件結(jié)構(gòu))None-sequenceofwords,bytes(順序的字和字節(jié))Simplerecordstructure(簡單的記錄結(jié)構(gòu))Lines(線性)Fixedlength(固定長度)Variablelength(可變長度)ComplexStructures(復(fù)雜結(jié)構(gòu))Formatteddocument(規(guī)格化的文檔)Relocatableloadfile(可重定位文件) Cansimulatelasttwowithfirstmethodbyinsertingappropriatecontrolcharacters.(可以用第一個(gè)方法通過增加適當(dāng)?shù)目刂谱址麃砟M后兩種方法)Whodecides(需要決定)Operatingsystem(操作系統(tǒng))Program(程序)OperatingSystemConceptsFileAttributes(文件屬性)Name–onlyinformationkeptinhuman-readableform.(文件名:唯一的以人們可以理解的方式保存的信息)Type–neededforsystemsthatsupportdifferenttypes.(類型:需要可以支持多種類型的系統(tǒng))Location–pointertofilelocationondevice.(位置:指向文件在設(shè)備上的存儲位置的指針)Size–currentfilesize.(大?。寒?dāng)前文件的大?。㏄rotection–controlswhocandoreading,writing,executing.(保護(hù):控制對文件的讀取,改寫和執(zhí)行的權(quán)限)Time,date,anduseridentification–dataforprotection,security,andusagemonitoring.(時(shí)間,日期和用戶身份:保護(hù)和安全需要的數(shù)據(jù))Informationaboutfilesarekeptinthedirectorystructure,whichismaintainedonthedisk.(文件的信息保存在磁盤上的目錄結(jié)構(gòu)中)OperatingSystemConceptsFileOperations(文件操作)Create(創(chuàng)建)Write(改寫)Read(讀?。﹔epositionwithinfile–fileseek(重定位文件,文件搜索)Delete(刪除)Truncate(截去)open(Fi)–searchthedirectorystructureondiskforentryFi,andmovethecontentofentrytomemory.(打開(Fi):在磁盤上的目錄結(jié)構(gòu)中搜尋Fi的表項(xiàng),然后把表項(xiàng)的內(nèi)容移動到內(nèi)存中)close(Fi)–movethecontentofentryFiinmemorytodirectorystructureondisk.(關(guān)閉(Fi):把Fi在內(nèi)存中的表項(xiàng)內(nèi)容移動到磁盤中OperatingSystemConceptsFileTypes–Name,ExtensionOperatingSystemConceptsAccessMethods(存取方法)SequentialAccess(順序存?。?/p>

readnext(讀下一個(gè))

writenext(寫下一個(gè))

reset(復(fù)位)

noreadafterlastwrite(未曾讀?。? (rewrite)DirectAccess(直接存?。?/p>

readn(讀第n項(xiàng))

writen(寫第n項(xiàng))

positionton(移動位置到第n項(xiàng))

readnext(讀下一個(gè))

writenext(寫下一個(gè))

rewriten(重寫第n個(gè))

n=relativeblocknumber(n為相對塊數(shù)OperatingSystemConceptsSequential-accessFileOperatingSystemConceptsSimulationofSequentialAccessonaDirect-accessFileOperatingSystemConceptsExampleofIndexandRelativeFilesOperatingSystemConceptsDirectoryStructure(目錄結(jié)構(gòu))Acollectionofnodescontaininginformationaboutallfiles.(一個(gè)包含著所有文件信息的節(jié)點(diǎn)的集合)F1F2F3F4FnDirectoryFilesBoththedirectorystructureandthefilesresideondisk.(目錄結(jié)構(gòu)和文件都在磁盤上)Backupsofthesetwostructuresarekeptontapes.(備份放在磁帶上)OperatingSystemConceptsATypicalFile-systemOrganizationOperatingSystemConceptsInformationinaDeviceDirectory

設(shè)備目錄中的信息Name(名稱)Type(類型)Address(地址)Currentlength(當(dāng)前長度)Maximumlength(最大長度)Datelastaccessed(forarchival)(最后訪問時(shí)間)Datelastupdated(fordump)(數(shù)據(jù)最后更新時(shí)間)OwnerID(whopays)(所有者ID)Protectioninformation(discusslater)(保護(hù)信息)OperatingSystemConceptsOperationsPerformedonDirectory

目錄操作Searchforafile(查找文件)Createafile(建立文件)Deleteafile(刪除文件)Listadirectory(顯示目錄)Renameafile(重命名文件)Traversethefilesystem(整體操作文件系統(tǒng))OperatingSystemConceptsOrganizetheDirectory(Logically)toObtain

目錄組織Efficiency–locatingafilequickly. 效率:快速的定位一個(gè)文件Naming–convenienttousers.(命名:方便用戶)Twouserscanhavesamenamefordifferentfiles. (兩個(gè)用戶可以有相同名字的不同文件)Thesamefilecanhaveseveraldifferentnames. (相同的文件可以有不同的名字)Grouping–logicalgroupingoffilesbyproperties,(e.g.,allPascalprograms,allgames,…)

分組:從邏輯上對文件按屬性進(jìn)行分組,比如所有的Pascal程序,游戲OperatingSystemConceptsSingle-LevelDirectory

單級目錄Asingledirectoryforallusers.Namingproblem

GroupingproblemOperatingSystemConceptsTwo-LevelDirectory

兩級目錄Separatedirectoryforeachuser.PathnameCanhavethesamefilenamefordifferentuserEfficientsearchingNogroupingcapabilityOperatingSystemConceptsTree-StructuredDirectories

樹型目錄OperatingSystemConceptsTree-StructuredDirectories(Cont.)

樹型目錄(續(xù))Efficientsearching

(有效的搜索)GroupingCapability

(分組的可能)Currentdirectory(workingdirectory)

(當(dāng)前目錄—工作目錄)cd/spell/mail/progtypelistOperatingSystemConceptsTree-StructuredDirectories(Cont.)

樹型目錄(續(xù))Absoluteorrelativepathname(絕對或相對路徑名)Creatinganewfileisdoneincurrentdirectory. (建立新文件在當(dāng)前路徑下)Deleteafile(刪除一個(gè)文件)

rm<file-name>Creatinganewsubdirectoryisdoneincurrentdirectory.(建立新子目錄在當(dāng)前路徑下) mkdir<dir-name> Example:ifincurrentdirectory/mail mkdircountmailprogcopyprtexpcountDeleting“mail”deletingtheentiresubtreerootedby“mail”.OperatingSystemConceptsAcyclic-GraphDirectories

無環(huán)圖結(jié)構(gòu)目錄Havesharedsubdirectoriesandfiles.OperatingSystemConceptsAcyclic-GraphDirectories(Cont.)

無環(huán)圖結(jié)構(gòu)目錄(續(xù))Twodifferentnames(aliasing)(別名:兩個(gè)不同的名字)Ifdictdeleteslist

danglingpointer. Solutions:(解決方案)Backpointers,sowecandeleteallpointers. (斷點(diǎn),我們可以刪除所有的指針)Variablesizerecordsaproblem. (可變大小記錄問題)Backpointersusingadaisychainorganization. (斷點(diǎn)組織成菊花鏈的形式)Entry-hold-countsolution.(表項(xiàng)保留計(jì)數(shù)的解決)OperatingSystemConceptsGeneralGraphDirectory(普通圖結(jié)構(gòu)目錄)OperatingSystemConceptsGeneralGraphDirectory(Cont.)

普通圖結(jié)構(gòu)目錄(續(xù))Howdoweguaranteenocycles?(如何保證無環(huán))Allowonlylinkstofilenotsubdirectories. 只允許鏈接到文件而不允許鏈接到子目錄Garbagecollection.(碎片收集)EverytimeanewlinkisaddeduseacycledetectionalgorithmtodeterminewhetheritisOK.

每次添加一個(gè)鏈接時(shí)都用一個(gè)檢測算法判斷是否不正確OperatingSystemConceptsFileSystemMounting(文件系統(tǒng)安裝)Afilesystemmustbemountedbeforeitcanbeaccessed.

文件系統(tǒng)在訪問前必須安裝Aunmountedfilesystem(I.e.Fig.11-11(b))ismountedatamountpoint.

圖11-11根據(jù)安裝指針一個(gè)未安裝文件系統(tǒng)被安裝OperatingSystemConcepts(a)Existing.(b)UnmountedPartitionOperatingSystemConceptsMountPointOperatingSystemConceptsFileSharing(文件共享)Sharingoffilesonmulti-usersystemsisdesirable.

在對用戶系統(tǒng)中文件共享是需要的。Sharingmaybedonethroughaprotectionscheme.

共享是通過保護(hù)機(jī)制實(shí)現(xiàn)的。Ondistributedsystems,filesmaybesharedacrossanetwork.

在分布式系統(tǒng)中,文件可以通過網(wǎng)絡(luò)共享。NetworkFileSystem(NFS)isacommondistributedfile-sharingmethod.

網(wǎng)絡(luò)文件系統(tǒng)(NFS)是一種通用的分布式文件共享方法。OperatingSystemConceptsProtection(保護(hù))Fileowner/creatorshouldbeabletocontr

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論