File system is implemented on disk and memory. How to implement the file system, it varies according to operating system and file system. But all the operating system follow some general rules.
File System Implementation
•
File system is implemented on disk and memory. How to implement the file
system, it varies according to operating system and file system. But all the
operating system follow some general rules. If the file system is implemented
on the disk, it contains the following information:
1. Boot block control:
Boot block is maintained per volume. The boot block contains solve the initial
bootstrap program used to load the operating system. Operating system requires some information at the time of booting. If the disk is divided into
number of partitions, the operating system is stored in the first partition of
the disk. If the operating system is not installed on the disk, then this block
can be empty. In UNIX file system, this is called the book block and in
2. Volume control block:
It consists of volume or partitions detail information. The information like
block size, number of blocks in the partition, free block count, free block
pointer, free FCB count and FCB pointers. In UNIX operating system, each
partition is a standalone file system. Super block is name in UNIX file system.
A super block describes the state of the file system: The total size of the
partition, the block size, pointers to a list of free blocks, the inode number
of the root directory, magic number, etc. In network file system, it is stored
in the master file table.
3. Directory structure:
It is used to organize the files. Directory structure is maintained per file
system.
4. Per-file PCB:
It contains information about files such as file size, file ownership, file
permission and location of data blocks. In NTFS, master file table stored this
information. Master table file uses a relational database structure.
• In-memory information is used for
caching and files system management. Caching improve the performance.
1.
In-memory mount table: It contains information about each
mounted volume.
2.
In-memory directory structure cache: It contains recently
accessed directories information.
3.
System wide open table: Open files FCB information is
stored.
4.
Per-process open file table: It maintains the pointer
to the appropriate entry in the system wide open file tables.
• UNIX operating system treats a
directory exactly as a file. Windows NT implements separate system calls for
files and directories. It treats directory as entities separate from files. Fig.
6.8.1 shows a file control block.
• FCB specify the information that the
system needs to manage a file. Sometimes it is called file attributes. These
are highly system dependent structures. For creating new file, an application
program calls the logical file system.
Optimizations
for file system:
•
Delayed updates of data and metadata are main difficulty. Updates could be sins
delayed in the hope that the same data might be updated in the future or that
the updated data might be temporary and might be deleted in the near future.
•
If computer were to crash without having committed the delayed updates, then
the consistency of the file system is destroyed.
Metadata
updates:
•
For recoverable file system, after crash, it must be consistent or must be able
to be made consistent. So it is necessary to prove that logging metadata
updates keeps the file system in a consistent.
•
For
inconsistent file system, the metadata must be written incompletely. Sometime,
file system data structures is in wrong order. With metadata logging, the
writes are made to a sequential log.
•
The complete transaction is written there before it is moved to the file system
structures. While updating data, file system crashed, the updates can be
completed based on the information in the log.
Introduction to Operating Systems: Unit IV(b): File System : Tag: : File System - Introduction to Operating Systems - File System Implementation
Introduction to Operating Systems
CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation