intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Bài giảng Hệ điều hành nâng cao - Chapter 11: File System Implementation

Chia sẻ: Xaydung K23 | Ngày: | Loại File: PPTX | Số trang:63

188
lượt xem
14
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

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.

Chủ đề:
Lưu

Nội dung Text: Bài giảng Hệ điều hành nâng cao - Chapter 11: File System Implementation

  1. Chapter 11: File System Implementation Operating System Concepts– 8th 8th Edition Operating System Concepts – Edition 11.1 Silberschatz, Galvin and Gagne ©2009
  2. 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
  3. 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
  4. 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
  5. Layered File System Operating System Concepts – 8th Edition 11.5 Silberschatz, Galvin and Gagne ©2009
  6. 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
  7. 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
  8. 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
  9. A Typical File Control Block Operating System Concepts – 8th Edition 11.9 Silberschatz, Galvin and Gagne ©2009
  10. 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
  11. In-Memory File System Structures Operating System Concepts – 8th Edition 11.11 Silberschatz, Galvin and Gagne ©2009
  12. 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
  13. 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
  14. Schematic View of Virtual File System Operating System Concepts – 8th Edition 11.14 Silberschatz, Galvin and Gagne ©2009
  15. 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
  16. 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
  17. 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
  18. 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
  19. Contiguous Allocation of Disk Space Operating System Concepts – 8th Edition 11.19 Silberschatz, Galvin and Gagne ©2009
  20. 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
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
47=>2