操作系统第四章课件
,这时系统会对用户发出警告,要求用户清理 自己的文件以释放空间。若用户在限期内没有 释放出空间,将不能再保存任何文件。 hard limit——是分配给每个用户的最大空间。 如果用户超过这个限制就不能再保存文件。
Grace
period(限期) identifies how long the soft limit may be exceeded
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.
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.
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)
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
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 (增 量转储).
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)
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(文件系统).
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.
29
File System Backfor 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
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的空间
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.
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
Every file, even a 1-byte file, ties up an entire
block. Small files waste a large amount of disk space.
Small
block size: