operatingsystem操作系统ch10filesysteminterface42.ppt
《operatingsystem操作系统ch10filesysteminterface42.ppt》由会员分享,可在线阅读,更多相关《operatingsystem操作系统ch10filesysteminterface42.ppt(42页珍藏版)》请在三一办公上搜索。
1、Chapter 10:File-System Interface,掣砸野怒好擂笼急余橡粉型榔棺献奈幸乾萨园汝怯巷辞熄乎窑固潦刺渣结operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,Chapter Objectives,To explain the function of file systemsTo describe the interfaces to file systemsTo discuss file-system design tradeo
2、ffs,including access methods,file sharing,file locking,and directory structuresTo explore file-system protection,养痒看弃乌盖被酥火香价申画吮惺罐瘤笋按柏啪蹈酗廉握法奋镜讥晒哪悼operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,Content Overview,File ConceptAccess MethodsDirectory Str
3、uctureFile-System MountingFile SharingProtection,局脂穷屁巡贰媚炙嗽栏罕蚂磐弃畦朝鹅臃揖气转埂撩枉潮汽瞩膊窗乾黑魔operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,10.1 File Concept,Contiguous logical address spaceTypes:DatanumericcharacterbinaryProgram,常砚缅桥滋函运景蛙移番泛外点躺逝缺匀牛谅潜痔慎哼腥枯瞳狱颜株
4、囚手operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,File Structure,None-sequence of words,bytesSimple record structureLines Fixed lengthVariable lengthComplex StructuresFormatted documentRelocatable load fileCan simulate last two with first method by
5、inserting appropriate control charactersWho decides:Operating systemProgram,羊沛霹射费孝跺身撂咏雹氏鉴屈厕毋钠砷疽凋线恋捡歇寨经桌捻弗临巨试operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,File Attributes,Name only information kept in human-readable formIdentifier unique tag(number
6、)identifies file within file systemType needed for systems that support different typesLocation pointer to file location on deviceSize current file sizeProtection controls who can do reading,writing,executingTime,date,and user identification data for protection,security,and usage monitoringInformati
7、on about files are kept in the directory structure,which is maintained on the disk,为描瘩瘤饯呐剖肥次滨卉贪禹瓶骋漠磅鲁睛哀淌销噎归隐皿辱含坷一滑许operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,File Operations,File is an abstract data typeCreateWriteReadReposition within fileDele
8、teTruncateOpen(Fi)search the directory structure on disk for entry Fi,and move the content of entry to memoryClose(Fi)move the content of entry Fi in memory to directory structure on disk,怕苦座肠命否验肩旗漏避鸥煽校蜂腺赛老沃像陨儡瞧悔爆滔慑硝协鞭乏诣operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-s
9、ystem interface-42,Open Files,Several pieces of data are needed to manage open files:File pointer:pointer to last read/write location,per process that has the file openFile-open count:counter of number of times a file is open to allow removal of data from open-file table when last processes closes i
10、tDisk location of the file:cache of data access informationAccess rights:per-process access mode information,纷贵巾座摆焚滚矢贝爪缀蒸芬售努损戚窿肚捍典陇疟树玛赛岔析衫隧赌迈operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,Open File Locking,Provided by some operating systems and fil
11、e systemsMediates access to a fileMandatory or advisory:Mandatory access is denied depending on locks held and requestedAdvisory processes can find status of locks and decide what to do,绽必逻耻贞栈婿尽溢惰你湘佑撅烫茬褐创胆蚂厅被游充纵掌光康平锁环酝operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-sys
12、tem interface-42,File Locking Example Java API,import java.io.*;import java.nio.channels.*;public class LockingExample public static final boolean EXCLUSIVE=false;public static final boolean SHARED=true;public static void main(String arsg)throws IOException FileLock sharedLock=null;FileLock exclusiv
13、eLock=null;try RandomAccessFile raf=new RandomAccessFile(file.txt,rw);/get the channel for the fileFileChannel ch=raf.getChannel();/this locks the first half of the file-exclusiveexclusiveLock=ch.lock(0,raf.length()/2,EXCLUSIVE);/*Now modify the data.*/release the lockexclusiveLock.release();,捅胺袭谊涣惨
14、市移凛靴霓胖孵娠恳奶仓沏吗燥邪大沈钮良棉框支墒蝉盲篱operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,File Locking Example Java API(cont),/this locks the second half of the file-sharedsharedLock=ch.lock(raf.length()/2+1,raf.length(),SHARED);/*Now read the data.*/release the lo
15、cksharedLock.release();catch(java.io.IOException ioe)System.err.println(ioe);finally if(exclusiveLock!=null)exclusiveLock.release();if(sharedLock!=null)sharedLock.release();,沿陋织召獭沽呸跃举卡瘪渤任玻希介瘟宝浪臣爵张哨宁溺捧示威暮猛出锈operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interfac
16、e-42,File Types Name,Extension,侍谴闰增莫摊葬啤枝模檬词去怒舟匪捕贪熬哭衍空侵诧掏膜狸傅井侵疥阵operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,10.2 Access Methods,Sequential Accessread nextwrite next resetno read after last write(rewrite)Direct Accessread nwrite nposition to nread
17、 nextwrite next rewrite nn=relative block number,院翅制宗笋佛舱靴帚料疮被跋畜晚姬搜删媚揖抿菊悄峨辉擒臼舞轨侍谦则operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,Sequential-access File,努翟砸瀑勋案衔溯舰遣糕谈汪翅唐湍窒巴观予住戏裂昼矗抵佩曙栗希硫由operating system操作系统ch10-file-system interface-42operating system
18、操作系统ch10-file-system interface-42,Simulation of Sequential Access on a Direct-access File,寇换麓楞淀反油蟹岳凄喊讯巡怖旭棘绰异羔货热龄攀争痴传坏兜惜梁胆雍operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,Example of Index and Relative Files,莽秤娶岸边拆铜唐宫汗纬氧奋爱耿我暖杆狡姬朋槽毒棉兢保眼募勾浸绑祝operating s
19、ystem操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,10.3 Directory Structure,A collection of nodes containing information about all files,F 1,F 2,F 3,F 4,F n,Directory,Files,Both the directory structure and the files reside on diskBackups of these two structures a
20、re kept on tapes,砸甲愿拆胁腆荡腕德未租迢慎府部厕鹰疼蚌同妆篙暂叮绿演搓北亚政宾衔operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,A Typical File-system Organization,揣拽墨臃绒胳摩褒纬素萌弄耙腺宙敞夸娘施牧勤碧贫书葵癸钩扳聂颤蓟候operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system
21、 interface-42,Operations Performed on Directory,Search for a fileCreate a fileDelete a fileList a directoryRename a fileTraverse the file system,飘漓疟竭世最咯抨樱服霉殉填奸痹本桨匀旭沟韶鄂腑既交辰澈考坏炽艺涩operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,Organize the Directory(L
22、ogically)to Obtain,Efficiency locating a file quicklyNaming convenient to usersTwo users can have same name for different filesThe same file can have several different namesGrouping logical grouping of files by properties,(e.g.,all Java programs,all games,),坚哦番郑宵决代自聂梨铃恭馅促我晶证茄权苟绩莫蕴妨感符掉酥峦磷琢焊operating
23、system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interface-42,Single-Level Directory,A single directory for all users,Naming problemGrouping problem,燃支就稚食撩脯毒篱抗狡咋荆箔赊国泄泌默足盆践陆究辑兜座源觉汤里晓operating system操作系统ch10-file-system interface-42operating system操作系统ch10-file-system interf
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- operatingsystem 操作系统 ch10filesysteminterface42
链接地址:https://www.31ppt.com/p-5105820.html