操作系统 -文件管理
2014-06-10 16:45
281 查看
文件操作:
File is an abstract data type
Create
Write
Read
Reposition within file
Delete
Truncate
Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory
Close (Fi) – move the content of entry Fiin memory to directory structure on disk
文件访问方式:
1Sequential Access
2 Direct Access
基于目录的操作 perations Performed on Directory
Search for a file
Create a file
Delete a file
List a directory
Rename a file
Traverse the file system
设置目录的作用:Organize the Directory (Logically) to Obtain
Efficiency – locating a file quickly
Naming – convenient to users
Two users can have same name for different files
The same file can have several different names
Grouping – logical grouping of files by properties
目录结构:
1Single-Level Directory
2Two-Level Directory
3Tree-Structured Directories
文件访问权限类型:Types of access
Read
Write
Execute
Append
Delete
List
分层文件系统架构:
应用层:文件
逻辑文件系统:文件的逻辑块
文件组织模块层:文件管理单元将文件的逻辑块映射成物理块
基本文件系统层:控制驱动程序
I/O控制层:控制物理文件的读写
设备层:磁盘 ,存放物理文件
文件控制块内容:
虚拟文件系统架构:
VFS allows the same system call interface (the API) to be used for different types of file systems.
目录实现方法:
1. Linear list of file names with pointer to the data blocks.
simple to program
time-consuming to execute
2. Hash Table – linear list with hash data structure.
decreases directory search time
collisions – situations where two file names hash to the same location
fixed size
文件内存管理方法:
Contiguous allocation:Each file occupies a set of contiguous blocks on the disk
连续分配:创建文件时,给文件分配一组连续的块
优点
简单
支持顺序存取和随机存取
顺序存取速度快
缺点
外部碎片;
预分配;
Extent-based file systems allocate disk blocks in extents
An extent is a contiguous block of disks
Extents are allocated for file allocation
A file consists of one or more extents.
Linked allocation
链式分配方法:创建文件时,每块都包含指向下一块的指针
优点
提高了磁盘空间利用率,不存在外部碎片问题
有利于文件插入、删除和扩充
缺点
存取速度慢,适宜顺序存取,不适于随机存取
链接指针占用一定的空间
可靠性问题
Indexed allocation
索引分配方法:创建文件时,文件的信息存放在若干不连续物理块中。在文件分配表中有一个一级索引。支持顺序和直接访问,最普遍的一种文件分配形式。
优点
既能顺序存取,又能随机存取
满足了文件动态增长、插入删除的要求
能充分利用外存空间
缺点
需要访问两次内存:索引表、具体物理块
索引表本身带来了系统开销
优 点
1.索引节点大小固定,并且相对较小;
2小文件可以快速访问,减少处理时间;
3.文件大小满足应用程序需求;
Free-Space Management (Cont.)
Bit map requires extra space
Example:
block size = 212bytes
disk size = 230bytes (1 gigabyte)
n = 230/212= 218bits (or 32K bytes)
Easy to get contiguous files
Linked list (free list)
Cannot get contiguous space easily
No waste of space
Grouping分组(成组链接法):
把n个空闲块的地址存放在第一个空闲块中,其中前n-1个块是真正空闲的,最后一个块包含另一组个块是真正空闲的,最后一个块包含另一组n块的地址,……
优点:可以迅速找到大量的空闲盘块,不象标准链接列表方法。
Counting 计数:
保持首个空闲块的地址以及其后连续空闲块的数量n.
空闲空间列表的每个条目由一个磁盘地址和一个计数组成。
File is an abstract data type
Create
Write
Read
Reposition within file
Delete
Truncate
Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory
Close (Fi) – move the content of entry Fiin memory to directory structure on disk
文件访问方式:
1Sequential Access
2 Direct Access
基于目录的操作 perations Performed on Directory
Search for a file
Create a file
Delete a file
List a directory
Rename a file
Traverse the file system
设置目录的作用:Organize the Directory (Logically) to Obtain
Efficiency – locating a file quickly
Naming – convenient to users
Two users can have same name for different files
The same file can have several different names
Grouping – logical grouping of files by properties
目录结构:
1Single-Level Directory
2Two-Level Directory
3Tree-Structured Directories
文件访问权限类型:Types of access
Read
Write
Execute
Append
Delete
List
分层文件系统架构:
应用层:文件
逻辑文件系统:文件的逻辑块
文件组织模块层:文件管理单元将文件的逻辑块映射成物理块
基本文件系统层:控制驱动程序
I/O控制层:控制物理文件的读写
设备层:磁盘 ,存放物理文件
文件控制块内容:
虚拟文件系统架构:
VFS allows the same system call interface (the API) to be used for different types of file systems.
目录实现方法:
1. Linear list of file names with pointer to the data blocks.
simple to program
time-consuming to execute
2. Hash Table – linear list with hash data structure.
decreases directory search time
collisions – situations where two file names hash to the same location
fixed size
文件内存管理方法:
Contiguous allocation:Each file occupies a set of contiguous blocks on the disk
连续分配:创建文件时,给文件分配一组连续的块
优点
简单
支持顺序存取和随机存取
顺序存取速度快
缺点
外部碎片;
预分配;
Extent-based file systems allocate disk blocks in extents
An extent is a contiguous block of disks
Extents are allocated for file allocation
A file consists of one or more extents.
Linked allocation
链式分配方法:创建文件时,每块都包含指向下一块的指针
优点
提高了磁盘空间利用率,不存在外部碎片问题
有利于文件插入、删除和扩充
缺点
存取速度慢,适宜顺序存取,不适于随机存取
链接指针占用一定的空间
可靠性问题
Indexed allocation
索引分配方法:创建文件时,文件的信息存放在若干不连续物理块中。在文件分配表中有一个一级索引。支持顺序和直接访问,最普遍的一种文件分配形式。
优点
既能顺序存取,又能随机存取
满足了文件动态增长、插入删除的要求
能充分利用外存空间
缺点
需要访问两次内存:索引表、具体物理块
索引表本身带来了系统开销
优 点
1.索引节点大小固定,并且相对较小;
2小文件可以快速访问,减少处理时间;
3.文件大小满足应用程序需求;
Free-Space Management (Cont.)
Bit map requires extra space
Example:
block size = 212bytes
disk size = 230bytes (1 gigabyte)
n = 230/212= 218bits (or 32K bytes)
Easy to get contiguous files
Linked list (free list)
Cannot get contiguous space easily
No waste of space
Grouping分组(成组链接法):
把n个空闲块的地址存放在第一个空闲块中,其中前n-1个块是真正空闲的,最后一个块包含另一组个块是真正空闲的,最后一个块包含另一组n块的地址,……
优点:可以迅速找到大量的空闲盘块,不象标准链接列表方法。
Counting 计数:
保持首个空闲块的地址以及其后连续空闲块的数量n.
空闲空间列表的每个条目由一个磁盘地址和一个计数组成。
相关文章推荐
- 操作系统文件管理
- 11.1 文件管理 11.1.1 文件操作系统概念
- <计算机文化>4.操作系统和文件管理
- 计算机操作系统——文件管理(3)
- 计算机操作系统——文件管理(2)
- 操作系统文件管理
- 2015年考研核心考点命题思路解密——操作系统 第2章 进程管理 PV算法 文件打印问题 过桥问题
- 操作系统之文件管理
- 操作系统_再识(linux设备管理文件系统-devfs与udev)
- Ubuntu操作系统学习笔记之文件系统挂载管理
- 操作系统的文件管理功能
- 操作系统——文件管理
- 操作系统 第五章 文件管理
- 操作系统之文件管理
- 【操作系统】linux--文件管理-secureCRT上传下载文件
- 【操作系统】linux--文件管理--ADB 或 linux删除文件夹下一个或多个文件的命令
- 汤子瀛 操作系统整理[6]——第六章 文件管理
- 操作系统是以文件为单位对数据进行管理的
- 计算机操作系统——文件管理(1)
- 2015年考研核心考点命题思路解密——操作系统 第2章 进程管理 PV算法 文件打印问题