目录

文件系统基础

初始文件管理

文件——就是一组有意义的信息/数据集合

https://gitee.com/lienhui68/picStore/raw/master/null/20200714013736.png

文件之间应该怎么组织起来

https://gitee.com/lienhui68/picStore/raw/master/null/20200714014142.png

操作系统应该向上提供哪些功能

https://gitee.com/lienhui68/picStore/raw/master/null/20200714014221.png

从上往下看,文件应该如何放在外存

https://gitee.com/lienhui68/picStore/raw/master/null/20200714014321.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714014418.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714014508.png

文件的逻辑结构

https://gitee.com/lienhui68/picStore/raw/master/null/20200714073931.png

无结构文件

https://gitee.com/lienhui68/picStore/raw/master/null/20200714074116.png

有结构文件

https://gitee.com/lienhui68/picStore/raw/master/null/20200714074226.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714074242.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714074304.png

有结构文件的逻辑结构

https://gitee.com/lienhui68/picStore/raw/master/null/20200714074434.png

顺序文件

https://gitee.com/lienhui68/picStore/raw/master/null/20200714074717.png

私以为:这里的顺序文件改成线性文件好一点

https://gitee.com/lienhui68/picStore/raw/master/null/20200714074806.png

在实际应用中为了减少磁盘的I/O次数,操作系统会使用日志文件来记录对文件各个记录进行修改的信息,每隔一段比较长的时间把这些修改信息统一地合并到外存文件中。

索引文件

https://gitee.com/lienhui68/picStore/raw/master/null/20200714075106.png

索引顺序文件

https://gitee.com/lienhui68/picStore/raw/master/null/20200714075137.png

索引顺序文件(检索效率分析)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714075908.png

多级索引顺序文件

https://gitee.com/lienhui68/picStore/raw/master/null/20200714080023.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714080052.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714080113.png

文件目录

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082119.png

文件控制块

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082228.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082244.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082301.png

目录结构

单级目录结构

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082346.png

两级目录结构

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082414.png

多级目录结构

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082532.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082738.png

树形目录结构可以很方便地对文件进行分类,层次结构清晰,也能够更有效地进行文件的管理和保护。但是,树形结构不便于实现文件的共享。为此,提出了“无环图目录结构”。

有向无环图目录结构

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082847.png

索引节点(FCB的改进)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714082911.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714083012.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714083040.png

文件的物理结构

也就是文件分配方式:文件数据应该怎样存放在外存中

https://gitee.com/lienhui68/picStore/raw/master/null/20200714085342.png

文件块、磁盘块

https://gitee.com/lienhui68/picStore/raw/master/null/20200714085538.png

内存块和磁盘块大小相同,方便数据交换

https://gitee.com/lienhui68/picStore/raw/master/null/20200714085715.png

连续分配

https://gitee.com/lienhui68/picStore/raw/master/null/20200714085850.png

读取某个磁盘块时,需要移动磁头。访问的两个磁盘块相隔越远,移动磁头所需时间就越长。

结论:连续分配的文件在顺序读/写时速度最快

https://gitee.com/lienhui68/picStore/raw/master/null/20200714090103.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714090131.png

连续分配方式要求每个文件在磁盘上占有一组连续的块

优点:支持顺序访问和直接访问(即随机访问);连续分配的文件在顺序访问时速度最快

缺点:不方便文件拓展;存储空间利用率低,会产生磁盘碎片

链接分配

链接分配采取离散分配的方式,可以为文件分配离散的磁盘块。分为隐式链接显式链接两种。

隐式链接

https://gitee.com/lienhui68/picStore/raw/master/null/20200714090422.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714090451.png

https://gitee.com/lienhui68/picStore/raw/master/null/image-20200714090550487.png

显式链接

https://gitee.com/lienhui68/picStore/raw/master/null/20200714090614.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714090637.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714090700.png

索引分配

https://gitee.com/lienhui68/picStore/raw/master/null/20200714093127.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714093300.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714093353.png

链接方案

https://gitee.com/lienhui68/picStore/raw/master/null/20200714093459.png

多层索引

https://gitee.com/lienhui68/picStore/raw/master/null/20200714094049.png

混合索引

https://gitee.com/lienhui68/picStore/raw/master/null/20200714094404.png

索引分配总结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714094442.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714094510.png

文件存储空间的管理

https://gitee.com/lienhui68/picStore/raw/master/null/20200714102450.png

存储空间的划分与初始化

https://gitee.com/lienhui68/picStore/raw/master/null/20200714102913.png

几种管理方法

从3个方面理解:1. 用什么方式记录、组织空闲块? 2. 如何分配磁盘块 3. 如何回收磁盘块

空闲表

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103030.png

空闲链表

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103126.png

空闲盘块

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103209.png

空闲盘区

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103320.png

位示图法

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103518.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103602.png

成组链接法

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103640.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714103731.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714104105.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714104202.png

文件的基本操作

创建文件(create系统调用)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105636.png

删除文件(delete系统调用)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105656.png

打开文件(open系统调用)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105734.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105810.png

关闭文件(close系统调用)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105836.png

读文件(read系统调用)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105857.png

写文件(write系统调用)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105918.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714105945.png

文件共享

https://gitee.com/lienhui68/picStore/raw/master/null/20200714121832.png

基于索引节点的共享方式(硬链接)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714121912.png

基于符号链的共享方式(软链接)

https://gitee.com/lienhui68/picStore/raw/master/null/20200714121932.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714121959.png

文件保护

口令保护

https://gitee.com/lienhui68/picStore/raw/master/null/20200714123435.png

加密保护

https://gitee.com/lienhui68/picStore/raw/master/null/20200714123505.png

访问控制

https://gitee.com/lienhui68/picStore/raw/master/null/20200714123531.png

https://gitee.com/lienhui68/picStore/raw/master/null/20200714123542.png

小结

https://gitee.com/lienhui68/picStore/raw/master/null/20200714123607.png

文件系统的层次结构

https://gitee.com/lienhui68/picStore/raw/master/null/20200714124443.png

各层对应知识点

用户接口 文件基本操作

文件目录系统 文件目录

存取控制模块 文件保护

逻辑文件系统与文件信息缓冲区 文件逻辑结构

物理文件系统 文件物理结构

辅助分配模块 文件存储空间管理

设备管理模块 磁盘管理

https://gitee.com/lienhui68/picStore/raw/master/null/20200714124546.png