操作系统20140419lecture16fs.x修复的

上传人:w****i 文档编号:92748296 上传时间:2019-07-12 格式:PPTX 页数:72 大小:690.01KB
返回 下载 相关 举报
操作系统20140419lecture16fs.x修复的_第1页
第1页 / 共72页
操作系统20140419lecture16fs.x修复的_第2页
第2页 / 共72页
操作系统20140419lecture16fs.x修复的_第3页
第3页 / 共72页
操作系统20140419lecture16fs.x修复的_第4页
第4页 / 共72页
操作系统20140419lecture16fs.x修复的_第5页
第5页 / 共72页
点击查看更多>>
资源描述

《操作系统20140419lecture16fs.x修复的》由会员分享,可在线阅读,更多相关《操作系统20140419lecture16fs.x修复的(72页珍藏版)》请在金锄头文库上搜索。

1、Operating Systems,Department of Computer Science & Technology Tsinghua University,Lecture 16: File System,Outline,Basic Concepts File System & File File Descriptor Directory File Aliasing Types of File System Virtual File System Data Block Caching Data Structures for Open Files File Allocation Free-

2、Space List Management of Multiple Disks RAID,File System and File,File system: an OS abstraction for using persistent storage Organizing, manipulating, navigating, accessing, and retrieving data on the persistent storage Most computer systems have file systems PCs, servers, laptops iPod, Tivo/set-to

3、p-box, cellphones/PDAs Google is made possible by a file system File: an OS abstraction for a unit of related data in the file system,File System Functionality,Allocate disk storage to files Managing file blocks (which blocks belong to which file) Managing free space (which blocks are free) Allocati

4、on algorithms (policies) Manage the collection of files Locate files and their contents Naming: interface to find files by name Most common: hierarchical file system(分层的文件系统) File system type (different ways to organize files) Provide convenience and features Protection: layers to keep data secure R

5、eliability/Durability: Keeping of files durable despite crashes, media failures, attacks, etc(可靠,持久),File and Blocks,File attributes Name, type, location, size, protection, creator, creation time, last-modified-time, File header On-storage metadata(元数据) storing information on each file Storing the f

6、ile attributes Tracking which blocks of the storage belong at which offsets within the logical file structure,Outline,Basic Concepts File System & File File Descriptor Directory File Aliasing Types of File System Virtual File System Data Block Caching Data Structures for Open Files File Allocation F

7、ree-Space List Management of Multiple Disks RAID,Open File and File Descriptor,File use model User program must “open” a file before use f = open(name, flag); = read(f, ); close(f); Kernel keeps track of open files for each process OS maintains an open file table per process An open file descriptor

8、is an index into this table,open file table,file descriptor,File Descriptor,Several pieces of data are needed to manage open files: File pointer: pointer to last read/write location, per process that has the file open File-open count: counter of number of times a file is open to allow removal of dat

9、a from open-file table when last processes closes it Disk location of the file: cache of data access information(作为文件的一个属性) Access rights: per-process access mode information,User vs System View of a File,Users view: Durable data structures At system call interface Collection of bytes (UNIX) Doesnt

10、matter to system what kind of data structures you want to store on disk! OSs internal view Collection of blocks (a block is a logical transfer unit, while a sector is the physical transfer unit) Block size sector size; in UNIX, block size is 4KB,Translating from User to System View,What happens if u

11、ser says: give me bytes 212? Fetch block corresponding to those bytes Return just the correct portion of the block What about: write bytes 212? Fetch block Modify portion Write out Block Everything inside File System is in whole size blocks For example, getc(), putc() buffers something like 4096 byt

12、es, even if interface is one byte at a time,Access Patterns,How do users access files? Need to know type of access patterns user is likely to throw at system Sequential access: bytes read in order Almost all file access are of this flavor(eg.系统备份,查病毒) Random Access: read/write element out of middle

13、Less frequent, but still important. For example, virtual memory backing file: page of memory stored in file Want this to be fast dont want to have to read all bytes to get to the middle of the file Content-based Access: by characteristics(比如在系统文件中找特定文件) Many systems dont provide this; instead, datab

14、ases are built on top of disk access to index content (requires efficient random access),Example of Index and Relative Files,File Internal Structure,No structure Sequence of words, bytes Simple record structure Lines Fixed length Variable length Complex structures Formatted document (e.g., MS Word,

15、PDF) Executable file ,File Sharing and Access Control,Sharing of files on multi-user systems is desirable Access control Who can have what type accesses to what files Types of access: read, write, execute, delete, list, etc. Per-file access control list (ACL) Unix model User IDs identify users, allo

16、wing permissions and protections to be per-user Group IDs allow users to be in groups, permitting group access rights,Consistency Semantics,Specify how multiple users/clients are to access a shared file simultaneously Similar to process synchronization algorithms Less complex due to disk I/O and network latency Unix file system (UFS) semantics Writes to an open file are visible immediately to other users of the same open file Sharing file pointer to allow multi

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号