What is a file system?
A file system is a system that is used by the operating system to keep files in a systematic way and to keep their entire information in the proper place.
In other words, The file system is a system used to manage system files.
The file is a set of related information that is stored in secondary storage such as – Magnetic disk, optical disc, etc.
The file can store any type of data such as – text, image, etc.
Whenever we store files in the system, we have to specify the file name and file type. That is, what format is the file? As if there is an image in the system, the image will be open in the image software itself.
file structure: –
A file can have lots of structure, some of them have the following : –
• Simple record structure
• Complex structure
• No definite structure
Such as – There is a sequence of letters in the text file.
The source file contains a sequence of procedures and functions.
An object is the sequence of bytes in the object file.
Types of file
All operating systems support different types of files, some of them are: –
1. Simple files: –
All the files that are created by the user are called ordinary files. These include information provided by the user. In ordinary files, we can store such information that includes text, image, database and other types of information. In these files, the user can do all the operations like insert, delete, modify, etc.
2. Directory files: –
The files that are stored in a particular directory or folder are called directory files. For example, a folder name is a video in which you have kept all the video, then we will call as many files as videos that we would call directory files.
3. Special files: –
Those files which are not created by the user i.e. those files which are required to run the system are known as special files.
These files are created by the system. Special files are also called system files. All system files are stored in the system itself and these files have a .sys extension.
4. fifo files: –
fifo means first in first out. The system uses fifo files to execute processes in one order. it means the process which comes first will be executed by first.
file access methods
The procedure in which the information in the files can be accessed and information is called access methods that can be read by memory.
The following file access methods are: –
1. Sequential access
2. Direct access
3. Indexed sequential access
1. Sequential access: –
This method of access is normal. In the sequential access, the information present in the file is accessed in sequence. That is, information is accessed one after the other in sequence.
Like: – we have a file that has 5 records, r1, r2, r3, r4, r5
So we will first access r1 then r2 and then in the end r5. We can not access direct r5
This method is used mostly by editors and compilers.
2. Direct access: –
Direct access is also called random access.
Through direct access, we can make direct access to any information present in the file. By this, we can access the file at very fast speed.
Each information in the file has its own address, so with the help of that address, it is accessed directly for read and write.
Sometimes we do not need to access every information in the file and we do not even need to access the information in order, in all cases we use direct access.
This method is commonly used in the database.
3. Indexed sequential access: –
This method is created based on sequential access. In this, the index is created for each file that contains the pointers for different blocks.
In this, when accessing files, the index is used to control the pointer.