当前位置:网站首页>File management: the physical structure of files
File management: the physical structure of files
2022-07-29 15:34:00 【Uncertainty!!】
1.文件的物理结构
逻辑结构:在用户看来,文件内部的数据是如何组织起来的
物理结构:在OS看来,文件的数据是如何放在外存(磁盘)中的
OSIdle and non-idle are required(已存数据)of disk blocks for management
Management of non-free blocks:文件分配方式
Management of free blocks:文件存储空间管理
1.1 文件分配方式
How file data is stored in external storage(磁盘)中
下图来自王道考研操作系统
1.1.1 连续分配
下图来自程序员cxuan
下图来自小林coding
下图来自王道考研操作系统
1.1.2 链接分配
1.1.2.1 隐式链接
下图来自王道考研操作系统
When searching for the next disk block, it is necessary to find the next disk block according to the pointer in the disk block,This requires moving the heads.This form of work makes the access speed not very fast.Implicit linkage supports sequential access,但不支持随机访问
下图来自程序员cxuan
1.1.2.2 显式链接
下图来自王道考研操作系统
文件分配表在内存中,从目录项中找到起始块号,If the logical block number given by the user is valid(The logical block number is greater than0),则查找FATThen the physical block number corresponding to the logical block number can be obtained,The query process does not need to read the disk.支持随机访问(Get the physical block number to be accessed directly,There is no need to work backwards from the first physical block number of the file),In fact, sequential access is also supported(从前往后找)
下图来自程序员cxuan
FAT文件分配表
1.1.3 索引分配
FAT需要占用较大的内存空间,在打开某个文件时,Just transfer the disk block number corresponding to the file into memory,完全没有必要将整个FAT调入内存.为此,We lump together all the disk block numbers for each file to form the index block/表(放在磁盘中)
下图来自王道考研操作系统
If a disk block can be stored256个索引项,But one file has more than one index entry256what plan should we adopt?
方案一:链接方案
将多个索引块/link table
To access the last logical block of the file,Then you have to sequentially access all the previous logical blocks,显然效率很低.This leads to a multi-level index
方案二:多层索引
There are secondary index tables in the second layer256个,Each secondary index table corresponds again256个,所以为256*256
The result of the division is the number of logical blocks,The result of the remainder is the number of table entries in the logical block
If it is a two-level index,is required to access the target data block3次磁盘I/O
If it is a three-level index,is required to access the target data block4次磁盘I/O
如果一个文件很小,It is still needed after using two layers of indexes3次读磁盘
方案三:混合索引(Different indexing schemes can be established for files of different sizes)
既包含直接地址索引(直接指向数据块)、又包含一级间接索引(指向单层索引表)、还包含两级间接索引(指向两层索引表)
The picture below is from my notesLinux文件系统
下图来自王道考研操作系统
边栏推荐
- error #6633: The type of the actual argument differs from the type of the dummy argument.
- Shell脚本编程-运算
- 走高质量、可持续的保障亿万家庭之路 水滴公司发布2020·2021ESG报告
- C语言 5:bool类型,关系表达式,逻辑表达式,分支语句,函数调用机制,break,continue,goto,return/exit跳转语句
- 小米法务部:成功打击一处伪造Redmi蓝牙耳机窝点,查扣假冒伪劣产品2032个
- 又一位AI大佬辞职进体制内!AI的尽头是编制?
- LeetCode·621.任务调度器·构造法
- I quit my job after cutting the brothers, and turned to do a small clerk
- 极市直播丨严彬-Unicorn:走向目标跟踪的大一统(ECCV2022 Oral)
- 深圳见!云原生加速应用构建专场:来看云原生 FinOps、SRE、高性能计算场景最佳实践
猜你喜欢
【微服务】(十六)—— 分布式事务Seata
分析Nacos配置及源码
C语言 3:常量和变量,顺序语句,选择语句,循环语句,作用域和生存期
AOP implementation enterprise API access interface monitoring (via Google Guava cache data)
Qt学习第一天
Why does APP use the JSON protocol to interact with the server: serialization related knowledge
文件管理:文件的逻辑结构
自动化配置SSH免密登录和取消SSH免密配置脚本
瑞萨RZ/G2L处理器详细测评
APP为什么用JSON协议与服务端交互:序列化相关知识
随机推荐
深圳见!云原生加速应用构建专场:来看云原生 FinOps、SRE、高性能计算场景最佳实践
C语言 5:bool类型,关系表达式,逻辑表达式,分支语句,函数调用机制,break,continue,goto,return/exit跳转语句
不会多线程还想进BAT?精选19道多线程面试题,有答案边看边学
一文详解8086微处理器系统结构
这个保护数据隐私的赛道,人人都想插一脚,互联网大厂挤破头,连甲方都下场自研了...
苹果涉险过关,全靠iPhone 13
【ArcGIS微课1000例】0030:ArcGIS利用MXD doctor工具分析并修复mxd地图文档
53 LeetCode 】 【. Most architectural array and
Immediate experience with CTS - | D further promotion application equipment compatibility
Qt实战 | 如何获取USB设备信息?
协同多智能体学习的价值分解网络的原理与代码复现
MySQL索引常见面试题(2022版)
走高质量、可持续的保障亿万家庭之路 水滴公司发布2020·2021ESG报告
NLP自然语言处理-机器学习和自然语言处理介绍(三)
Flink SQL Hudi 实战
Numpy
Linux安装MySQL(超详细)
关于数字化转型 你需要知道的八项指导原则
KDD'22博士论文奖:清华裘捷中成亚洲高校首位获得者,斯坦福Rex Ying获WINNER奖
令人难以置信的DeepMind数据库现在包括了科学界已知的几乎所有蛋白质