File management is another important function of an operating system. File management is necessary so that the operating system can map files onto physical devices. Here, in this article, we will learn about files and how file management is done in the system.
A file is a named collection of related information. Every file has a location on secondary storage or a non-volatile device like a magnetic disk, tapes, etc. The data cannot be written to secondary storage unless they are within a file. Commonly, files represent programs (both source and object forms) and data in the form of a sequence of bits, bytes or records. Each file in the system possesses desirable properties such as:
The file system is a mechanism that provides a means to store data and files in an organized manner along with the functions/operations that can be performed on files. The system identifies every file by its name and a unique identification number called inode number. The inode number refers to the physical file, the data stored in a particular location. Above all, it also maintains other sets of attributes associated with the file. There are different types of file systems a system may support. Some of which are mentioned below type of file system that an operating system supports are:
A file’s attributes may vary from one operating system to another but typically consist of these:
A user or the system can perform different operations on the files. It depends on the permission assigned to the file. Different operations that can be performed on the file are:
A common technique for implementing file types is to include the type as part of the file name. The system uses the extension to indicate the type of the file and the type of operations that can be done on that file. Various file types are executable, object, source code, batch, text, archive, etc.
A File Structure of a file is a predefined format in which the operating system understands. It has an exclusively defined structure, which is based on its type. The files must follow a required structure that is understood by the operating system.
On the other hand, if the operating system supports multiple file structures, the size of the kernel will increase. For instance, an operating system defines five different file structures, the kernel needs to have the code to support these file structures.
Different operating systems support different file structures according to the type of file. For instance,
Files store information. When required, this information must be accessed and read into computer memory. Some systems use only one type of access method, others might use many of them. Generally, a file in the system can be accessed using two ways:
There are a number of files that reside in the system. The directory records information -such as name, location, size, and type-for all files on a volume. A directory is viewed as a symbol table which can be organized in many ways. To understand how files are stored in the directory, we need to know what is the logical structure of the directory system. When considering the directory structure, we need to keep in mind what different operations that can be performed on a directory like:
The single-level directory is the simplest directory structure. All the files are stored in the same directory which is easy to understand. However, there are some limitations to this directory structure.
In this type of structure, each user has its own user file directory (UFD). Each UFD lists only files of a single user. When a user logs in to the system, the system will search the master file directory (MFD). When a user refers to a particular file, the system searches his own UFD. Therefore, different users may have files with the same name. Although this type of structure has resolved many limitations of the single-level directory, it still has many disadvantages
Extension of the two-level directory to an arbitrary height. Here, users can create their own subdirectories and organize their files accordingly. To access any file user can make use of absolute or relative paths
In the acyclic graph directory, user can share the files and subdirectories. Suppose two users want to work on a single project. They will save the data related to the project in a directory that is shared between the two. A tree structure prohibits the sharing of files or directories. An acyclic graph that is, a graph with no cycles-allows directories to share subdirectories and files.
The selection of directory-allocation and directory-management algorithms significantly affects the efficiency, performance, and reliability of the file system.
It is the simplest method of implementing directory. It makes use of a linear list of filenames with pointers to the data blocks. This method is simple to design but time-consuming in case of implementation.
It is a combination of a linear list and hash data structure. The hash table takes a value computed from the file name and returns a pointer to the file name in the linear list. The search time is comparatively less. Insertion and deletion are also easy.
The above discussion is summarized in the form of a PPT with animations below.
Note: Click within the slide area for animations. Clicking on the “next” slide button will not display any animation
Previous Next Page Replacement Algorithms File Allocation Methods