File System Implementation in Operating System
Prerequisite – File Systems in Operating Systems A file is a collection of related information. The file system resides on secondary storage and provides efficient and convenient access to the disk by allowing data to be stored, located, and retrieved.
File system is organized into many layers:
- I/O Control level – Device drivers acts as interface between devices and OS, they help to transfer data between disk and main memory. It takes block number as input and as output it gives low level hardware specific instruction.
- Basic file system – It Issues general commands to device driver to read and write physical blocks on disk.It manages the memory buffers and caches. A block in buffer can hold the contents of the disk block and cache stores frequently used file system metadata.
- File organization Module – It has information about files, location of files and their logical and physical blocks.Physical blocks do not match with logical numbers of logical block numbered from 0 to N. It also has a free space which tracks unallocated blocks.
- Logical file system – It manages metadata information about a file i.e includes all details about a file except the actual contents of file. It also maintains via file control blocks. File control block (FCB) has information about a file – owner, size, permissions, location of file contents.
Advantages :
- Duplication of code is minimized.
- Each file system can have its own logical file system.
Disadvantages: If we access many files at same time then it results in low performance. We can implement file system by using two types data structures :
- Boot Control Block – It is usually the first block of volume and it contains information needed to boot an operating system.In UNIX it is called boot block and in NTFS it is called as partition boot sector.
- Volume Control Block – It has information about a particular partition ex:- free block count, block size and block pointers etc.In UNIX it is called super block and in NTFS it is stored in master file table.
- Directory Structure – They store file names and associated inode numbers.In UNIX, includes file names and associated file names and in NTFS, it is stored in master file table.
- Per-File FCB – It contains details about files and it has a unique identifier number to allow association with directory entry. In NTFS it is stored in master file table.
- Mount Table – It contains information about each mounted volume.
- Directory-Structure cache – This cache holds the directory information of recently accessed directories.
- System wide open-file table – It contains the copy of FCB of each open file.
- Per-process open-file table – It contains information opened by that particular process and it maps with appropriate system wide open-file.
- Linear List – It maintains a linear list of filenames with pointers to the data blocks.It is time-consuming also.To create a new file, we must first search the directory to be sure that no existing file has the same name then we add a file at end of the directory.To delete a file, we search the directory for the named file and release the space.To reuse the directory entry either we can mark the entry as unused or we can attach it to a list of free directories.
- Hash Table – The hash table takes a value computed from the file name and returns a pointer to the file. It decreases the directory search time. The insertion and deletion process of files is easy. The major difficulty is hash tables are its generally fixed size and hash tables are dependent on hash function on that size.
key steps involved in file system implementation:
File system implementation is a crucial component of an operating system, as it provides an interface between the user and the physical storage device. Here are the key steps involved in file system implementation:
- Partitioning the storage device: The first step in file system implementation is to partition the physical storage device into one or more logical partitions. Each partition is formatted with a specific file system that defines the way files and directories are organized and stored.
- File system structures: File system structures are the data structures used by the operating system to manage files and directories. Some of the key file system structures include the superblock, inode table, directory structure, and file allocation table.
- Allocation of storage space: The file system must allocate storage space for each file and directory on the storage device. There are several methods for allocating storage space, including contiguous, linked, and indexed allocation.
- File operations: The file system provides a set of operations that can be performed on files and directories, including create, delete, read, write, open, close, and seek. These operations are implemented using the file system structures and the storage allocation methods.
- File system security: The file system must provide security mechanisms to protect files and directories from unauthorized access or modification. This can be done by setting file permissions, access control lists, or encryption.
- File system maintenance: The file system must be maintained to ensure efficient and reliable operation. This includes tasks such as disk defragmentation, disk checking, and backup and recovery.
Overall, file system implementation is a complex and critical component of an operating system. The efficiency and reliability of the file system have a significant impact on the performance and stability of the entire system.



Please Login to comment...