Bài giảng Hệ điều hành nâng cao - Chapter 11: File System Implementation
lượt xem 14
download
Bài giảng Hệ điều hành nâng cao - Chapter 11: File System Implementation trình bày về cấu trúc tập tin hệ thống, thực hiện tập tin hệ thống, thực hiện thư mục, phương pháp phân bổ, quản lý không gian trống,...Mời bạn đọc cùng tham khảo.
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Bài giảng Hệ điều hành nâng cao - Chapter 11: File System Implementation
- Chapter 11: File System Implementation Operating System Concepts– 8th 8th Edition Operating System Concepts – Edition 11.1 Silberschatz, Galvin and Gagne ©2009
- Chapter 11: File System Implementation s File-System Structure s File-System Implementation s Directory Implementation s Allocation Methods s Free-Space Management s Efficiency and Performance s Recovery s NFS s Example: WAFL File System Operating System Concepts – 8th Edition 11.2 Silberschatz, Galvin and Gagne ©2009
- Objectives s To describe the details of implementing local file systems and directory structures s To describe the implementation of remote file systems s To discuss block allocation and free-block algorithms and trade-offs Operating System Concepts – 8th Edition 11.3 Silberschatz, Galvin and Gagne ©2009
- File-System Structure s File structure q Logical storage unit q Collection of related information s File system resides on secondary storage (disks) q Provided user interface to storage, mapping logical to physical q Provides efficient and convenient access to disk by allowing data to be stored, located retrieved easily s Disk provides in-place rewrite and random access q I/O transfers performed in blocks of sectors (usually 512 bytes) s File control block – storage structure consisting of information about a file s Device driver controls the physical device s File system organized into layers Operating System Concepts – 8th Edition 11.4 Silberschatz, Galvin and Gagne ©2009
- Layered File System Operating System Concepts – 8th Edition 11.5 Silberschatz, Galvin and Gagne ©2009
- File System Layers s Device drivers manage I/O devices at the I/O control layer q Given commands like “read drive1, cylinder 72, track 2, sector 10, into memory location 1060” outputs low- level hardware specific commands to hardware controller s Basic file system given command like “retrieve block 123” translates to device driver s Also manages memory buffers and caches (allocation, freeing, replacement) s Buffers hold data in transit s Caches hold frequently used data s File organization module understands files, logical address, and physical blocks s Translates logical block # to physical block # s Manages free space, disk allocation Operating System Concepts – 8th Edition 11.6 Silberschatz, Galvin and Gagne ©2009
- File System Layers (Cont.) s Logical file system manages metadata information s Translates file name into file number, file handle, location by maintaining file control blocks (inodes in Unix) s Directory management s Protection s Layering useful for reducing complexity and redundancy, but adds overhead and can decrease performance s Logical layers can be implemented by any coding method according to OS designer s Many file systems, sometimes many within an operating system s Each with its own format (CD-ROM is ISO 9660; Unix has UFS, FFS; Windows has FAT, FAT32, NTFS as well as floppy, CD, DVD Blu-ray, Linux has more than 40 types, with extended file system ext2 and ext3 leading; plus distributed file systems, etc) s New ones still arriving – ZFS, GoogleFS, Oracle ASM, FUSE Operating System Concepts – 8th Edition 11.7 Silberschatz, Galvin and Gagne ©2009
- File-System Implementation s We have system calls at the API level, but how do we implement their functions? q On-disk and in-memory structures s Boot control block contains info needed by system to boot OS from that volume q Needed if volume contains OS, usually first block of volume s Volume control block (superblock, master file table) contains volume details q Total # of blocks, # of free blocks, block size, free block pointers or array s Directory structure organizes the files q Names and inode numbers, master file table s Per-file File Control Block (FCB) contains many details about the file q Inode number, permissions, size, dates q NFTS stores into in master file table using relational DB structures Operating System Concepts – 8th Edition 11.8 Silberschatz, Galvin and Gagne ©2009
- A Typical File Control Block Operating System Concepts – 8th Edition 11.9 Silberschatz, Galvin and Gagne ©2009
- In-Memory File System Structures s Mount table storing file system mounts, mount points, file system types s The following figure illustrates the necessary file system structures provided by the operating systems s Figure 12-3(a) refers to opening a file s Figure 12-3(b) refers to reading a file s Plus buffers hold data blocks from secondary storage s Open returns a file handle for subsequent use s Data from read eventually copied to specified user process memory address Operating System Concepts – 8th Edition 11.10 Silberschatz, Galvin and Gagne ©2009
- In-Memory File System Structures Operating System Concepts – 8th Edition 11.11 Silberschatz, Galvin and Gagne ©2009
- Partitions and Mounting s Partition can be a volume containing a file system (“cooked”) or raw – just a sequence of blocks with no file system s Boot block can point to boot volume or boot loader set of blocks that contain enough code to know how to load the kernel from the file system q Or a boot management program for multi-os booting s Root partition contains the OS, other partitions can hold other Oses, other file systems, or be raw q Mounted at boot time q Other partitions can mount automatically or manually s At mount time, file system consistency checked q Is all metadata correct? 4 If not, fix it, try again 4 If yes, add to mount table, allow access Operating System Concepts – 8th Edition 11.12 Silberschatz, Galvin and Gagne ©2009
- Virtual File Systems s Virtual File Systems (VFS) on Unix provide an object-oriented way of implementing file systems s VFS allows the same system call interface (the API) to be used for different types of file systems q Separates file-system generic operations from implementation details q Implementation can be one of many file systems types, or network file system 4 Implements vnodes which hold inodes or network file details q Then dispatches operation to appropriate file system implementation routines s The API is to the VFS interface, rather than any specific type of file system Operating System Concepts – 8th Edition 11.13 Silberschatz, Galvin and Gagne ©2009
- Schematic View of Virtual File System Operating System Concepts – 8th Edition 11.14 Silberschatz, Galvin and Gagne ©2009
- Virtual File System Implementation s For example, Linux has four object types: q inode, file, superblock, dentry s VFS defines set of operations on the objects that must be implemented q Every object has a pointer to a function table 4 Function table has addresses of routines to implement that function on that object Operating System Concepts – 8th Edition 11.15 Silberschatz, Galvin and Gagne ©2009
- Directory Implementation s Linear list of file names with pointer to the data blocks q Simple to program q Time-consuming to execute 4 Linear search time 4 Could keep ordered alphabetically via linked list or use B+ tree s Hash Table – linear list with hash data structure q Decreases directory search time q Collisions – situations where two file names hash to the same location q Only good if entries are fixed size, or use chained-overflow method Operating System Concepts – 8th Edition 11.16 Silberschatz, Galvin and Gagne ©2009
- Allocation Methods - Contiguous s An allocation method refers to how disk blocks are allocated for files: s Contiguous allocation – each file occupies set of contiguous blocks q Best performance in most cases q Simple – only starting location (block #) and length (number of blocks) are required q Problems include finding space for file, knowing file size, external fragmentation, need for compaction off-line (downtime) or on-line Operating System Concepts – 8th Edition 11.17 Silberschatz, Galvin and Gagne ©2009
- Contiguous Allocation s Mapping from logical to physical Q LA/512 R Block to be accessed = Q + starting address Displacement into block = R Operating System Concepts – 8th Edition 11.18 Silberschatz, Galvin and Gagne ©2009
- Contiguous Allocation of Disk Space Operating System Concepts – 8th Edition 11.19 Silberschatz, Galvin and Gagne ©2009
- Extent-Based Systems s Many newer file systems (i.e., Veritas File System) use a modified contiguous allocation scheme s Extent-based file systems allocate disk blocks in extents s An extent is a contiguous block of disks q Extents are allocated for file allocation q A file consists of one or more extents Operating System Concepts – 8th Edition 11.20 Silberschatz, Galvin and Gagne ©2009
CÓ THỂ BẠN MUỐN DOWNLOAD
-
Bài giảng Hệ điều hành nâng cao - Chapter 3: Processes
54 p | 137 | 15
-
Bài giảng Hệ điều hành nâng cao - Chapter 5: CPU Scheduling
67 p | 135 | 14
-
Bài giảng Hệ điều hành nâng cao - Chapter 19: Real - Time Systems
24 p | 101 | 13
-
Bài giảng Hệ điều hành nâng cao - Chapter 6: Process Synchronization
72 p | 201 | 11
-
Bài giảng Hệ điều hành nâng cao - Chapter 10: File - System Interface
43 p | 99 | 10
-
Bài giảng Hệ điều hành nâng cao - Chapter 12: Mass - Storage Systems
57 p | 166 | 10
-
Bài giảng Hệ điều hành nâng cao - Chapter 13: I/O Systems
42 p | 157 | 9
-
Bài giảng Hệ điều hành nâng cao - Chapter 2: Operating - System Structures
54 p | 173 | 9
-
Bài giảng Hệ điều hành nâng cao - Chapter 1: Introduction
48 p | 141 | 8
-
Bài giảng Hệ điều hành nâng cao - Chapter 4: Threads
45 p | 135 | 8
-
Bài giảng Hệ điều hành nâng cao - Chapter 21: The Linux System
62 p | 148 | 7
-
Bài giảng Hệ điều hành nâng cao - Chapter 20: Multimedia Systems
33 p | 128 | 6
-
Bài giảng Hệ điều hành nâng cao - Chapter 22: Windows XP
64 p | 92 | 6
-
Bài giảng Hệ điều hành nâng cao - Chapter 14: Protection
29 p | 77 | 5
-
Bài giảng Hệ điều hành nâng cao - Chapter 17: Distributed - File Systems
29 p | 86 | 5
-
Bài giảng Hệ điều hành nâng cao - Chapter 18: Distributed Coordination
54 p | 88 | 5
-
Bài giảng Hệ điều hành nâng cao - Chapter 16: Distributed System Structures
36 p | 100 | 4
Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn