/    /  OS – File System Implementation

File System Implementation

 

We can use the following data structures to implement file systems:

  1. On-disk structures
  2. In-memory structures

 

On-disk structures

They store information about the total number of disk blocks, their location, free disk blocks, etc. Different on-disk structures are as follows:

 

  • Directory structure

 

Directory structure stores the file names and associated inode numbers. 

 

  • Volume Control Block

 

Volume Control Block stores information about a particular partition. Examples: block pointers, free block count, etc.

 

  • Boost Control Block

 

Boost Control Block is generally the first block of volume and it stores the information needed to boot an operating system. It is also known as partition boot sector in NTFS and boot block in UNIX.

 

  • Per-File FCB

 

Per-File FCB stores details about files and has a unique identifier number to associate with the directory entry. 

 

In-memory structures

The in-memory structure is maintained in the main memory and is helpful for file management for caching. Different in-memory structures are:

 

  • Mount Table

 

Mount Table stores information about the mounted volume. 

 

  • Per-process open-file table

 

Per-process open-file table stores information opened by the process and it maps with the system open-file. 

 

  • Directory-structure cache

 

Directory-structure cache stores information about the recently accessed directories.

 

  • System-wide open-file table

 

The system-wide open-file table stores the copy of the FCB of each open file.

 

Directory Implementation

 

  • Linear List

 

Linear List stores a linear list of filenames with pointers to the data blocks. 

 

  • Hash Table

 

Hash Table stores the value computed from the file name and returns a pointer to the file. The only disadvantage of the hash table is that it is generally fixed in size. 

 

Reference

File System Implementation