Operating System Notes-Chapter 12 File System

File system

The content is more, the teacher speaks more shallowly.

1. Basic concepts

  • File system and files
    • File system: a system abstraction for persistent storage
    • File: The relevant data of a unit in the file system is abstracted in the operating system
    • The function of the file system:
      • Allocate file disk space (manage file blocks; manage free space; allocation algorithm)
      • Manage file collections (location; naming; the most common is the hierarchical file system)
      • Provide convenience and features (protection; reliability/persistence)
    • File and block: file attributes, stored in the file block, representing the characterizing attributes of the file
  • File descriptor: [Content is more, only record part] (User's perspective) metadata data is needed to manage open files
    • File pointer: point to the most recent read/write clerical job, this pointer is used by every process that opens this file
    • File open count: record the number of file open times. When the file is closed by the last process, it is allowed to be removed from the open file list
    • File disk location: cache data access information
    • Access authority: access mode information for each program
  • table of Contents
    • The files are organized in directories. Directory is a special kind of file. The early file system was flat, with only one level of directories. Hierarchical structure can be established by using directories. A directory is a linear list of file names, containing pointers to data blocks.
    • Typical operations: search, remove function keys, delete, and rename files; enumerate directories; traverse a path in the file system.
    • The operating system should only allow the kernel mode to modify the directory: to ensure the integrity of the mapping; the application system can read the directory (such as ls)
  • File alias
    • Multiple file names are associated with the same file. There are two ways to achieve: hard link (multiple file items point to one file); soft link (point to other files with "shortcuts").
  • File system type
    • Disk file system
    • Database file system
    • Journal file system
    • Network/Distributed File System
    • Special/Virtual File System

2. Virtual File System

  • Purpose: To abstract complex systems of different types, establish a virtual file system, provide file system APIs, shield the differences of the underlying system, and make the system application wider.
  • Features:
    • Provide the same file and file system interface
    • Manage all files and data structures associated with the file system
    • Efficient query routines to traverse the file system
    • Interaction with specific file system modules
  • The basic file system includes: volume control block superblock; file control block vnode/inode; directory node dentry

3. Data Cache

  • Data blocks are read into memory on demand
  • Data block is cached after use
  • Two data block caching methods
    • Normal buffer cache
    • Page cache: unified cache of data blocks and memory pages

4. Open the data structure of the file

There is a lock mechanism

5. File distribution

Management of documents. How to allocate data blocks for a file

Allocation

  • Continuous allocation
  • Chain distribution
  • Index allocation

index:

  • Efficient: such as storage utilization
  • Performance: such as access speed

6. Free space list

Mainly reflected in the disk management. Use bitmap/chain to manage free space.

7. Multiple Disk Management-RAID

Usually the disk is partitioned to minimize the seek time.

The file system consists of partitions. Partition is a partition of the hardware disk suitable for the specified format of the operating system

Volume: An accessible storage space with an instance of a file system, usually resident on a single partition of the disk.

Use multiple parallel disks to increase throughput and increase reliability and availability through redundancy. This resulted in the concept of redundant disk array RAID.

8. Disk Scheduling

The algorithm is similar to process scheduling, and the execution object is disk retrieval.

Elevator algorithm, SSTF\SCAN\CSCAN\FSCAN\N-Step-SCAN and other algorithms

Guess you like

Origin blog.csdn.net/MaoziYa/article/details/107493390