操作系统第四章课件

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
After that period, a user gets errors instead of
warnings
25
Example of quota
26
4.4.2 File System Backup
If
a computer’s file system is irrevocably (不 能取消的,无可挽回的) lost, restoring all the information will be difficult, time consuming, and in many cases, impossible. ——File System Backup
3
文件系统
用户角度 实现者角度 安全,保护 映射 文件访问 数据文件 文件结构 磁盘 空间分配 数据访问 设备保护
文件系统
4
Contents
4.1 Files 4.2 Directories 4.3 File System Implementation 4.4 File System Management and Optimization
(a) 简单目录,包含固定大小的目录项,在目 录项中有磁盘地址和属性 (b) 每个目录项只引用i节点的目录 15
目录的实现(2)

在目录中处理长文件名的两种方法:
(a) 在行中
(b) 在堆中
16
4.4 File System Management and Optimization
4.4.1 Disk Space Management 4.4.2 File System Backup 4.4.3 File System Consistency 4.4.4 File System Performance 4.4.5 Defragmenting Disks
10
4.3.2 Implementing Files文件 的实现 (1)
(a) 为7个文件连续分配空间 (b) 删除文件D和F后磁盘的状态
11
文件的实现(2)
以磁盘块的链表形式存储文件
12
文件的实现(3)
在内存中使用文件分配表的链表分配
13
文件的实现(4)
i结点的例子
14
4.3.3 Implementing directories目录的实现 (1)
28
File System Backup
3. It may be desirable to compress the data before writing them to the tape. 4. It is difficult to perform a backup on an active file system. So algorithms have been devised for making rapid snapshots of the file system state by copying critical data structures, and then requiring future changes to files and directories to copy the blocks instead of updating them in place. 5. Backup tapes should be kept off-site.
21
Keeping track of free blocks
Figure 4-22. (a) Storing the free list 22 on a linked list. (b) A bitmap.
3. Disk Quotas (磁盘配额)
prevent people from hogging (贪婪攫取) too much disk space, multi-user OS often provide a mechanism for enforcing disk quotas. The idea is that the system administrator assigns each user a maximum allotment of files and blocks, and the OS make sure that the users do not exceed their quotas.
Nearly all file systems chop (砍, 分割) files up into fixed-size blocks that need not be adjacent (相邻的).
18
1. Block Size
How
big the block should be? Large block size:
8
4.3 File System Implementation
4.3.1 File System Layout 4.3.2 Implementing Files 4.3.3 Implementing directories 4.3.4 Shared files 4.3.5 Journaling File Systems (JFS) 4.3.6 Virtual File Systems (VFS)
Every file, even a 1-byte file, ties up an entire
block. Small files waste a large amount of disk space.
Small
block size:
Most files will span (跨越) multiple blocks and
,这时系统会对用户发出警告,要求用户清理 自己的文件以释放空间。若用户在限期内没有 释放出空间,将不能再保存任何文件。 hard limit——是分配给每个用户的最大空间。 如果用户超过这个限制就不能再保存文件。
Grace
period(限期) identifies how long the soft limit may be exceeded
thus need multiple seeks and rotational delays( 旋转延迟) to read them, reducing performance.
19
Block Size
Historically,
file systems have chosen size in the 1-KB to 4-KB range, but with disks now exceeding 1 TB, it might be better to increase the block size to 64KB and accept the wasted disk space.
20
2. wenku.baidu.comeeping track of free blocks
Two
methods:
Using a linked list of disk blocks, with each
block holding as many free disk block numbers as will fit. Bitmap. A disk with n blocks requires a bitmap with n bits.
Advantages: can group7 files in natural ways
Directories
3. Path names Absolute path name (绝对路径): consisting of the path from the root directory to the file. It always start at the root directory and are unique. Relative path name (相对路径): it is used in conjunction with the concept of the working directory.
5
4.2 Directories
1. Single-level Directory systems
Advantages:
Simplicity
The ability to locate file quickly
6
Directories
2. Hierarchical (层次) directory systems
Chapter 4 File systems
长期存储信息
1.
能够存储大量信息
2.
使用信息的进程终止时,信息仍旧存在
多进程能够并发存取有关信息
3.
2
File Systems
Files
are logical units of information created by processes. That part of the OS dealing with files is known as the file system(文件系统).
To
23
Disk Quotas
Figure 4-24. Quotas are kept track of on a per-user basis 24 in a quota table.
Disk Quotas
Per quota two limits: Soft and Hard soft limit——用户可以使用超过soft limit的空间
9
4.3.1 File System Layout (布 局)
Sector 0 of the disk is called the MBR (Master Boot Record, 主引导记录) and is used to boot the computer. The end of the MBR contains the partition table.
17
4.4.1 Disk Space Management
Two
possible strategies for storing an n bytes file:
n consecutive (连续的) bytes of disk space are
allocated. ——Problems? The file is split up into a number of (not necessarily) contiguous blocks.
29
File System Backup
Two
strategies can be used for dumping a disk to tape:
A physical dump (物理转储) A logical dump (逻辑转储)
30
Physical dump
A physical dump starts at block 0 of the disk, write all the disk blocks onto the output tape in order, and stops when it has copied the last one. Advantages: Simplicity Great speed Disadvantages: The inability to skip selected directories The inability to make incremental dumps The inability to restore individual files upon request
27
File System Backup
1. Should the entire file system be backed up or only part of it? It is usually desirable to back up only specific directories and everything in them rather than the entire file system. 2. It is wasteful to back up files that have not changed since the previous backup, which leads to the idea of incremental dumps (增 量转储).
相关文档
最新文档