Web Development

How Does the File System of an Operating System Work?

File systems are an integral part of any operating system with the capacity for long-term storage. There are two distinct parts of a file system, the mechanism for storing files and the directory structure into which they are organised.

In modern operating systems where several users can access the same files simultaneously, it has also become necessary for such features as access control and different forms of file protection to be implemented.

What is a File?

A file is a collection of binary data. A file could represent a programme, a document, or, in some cases, part of the file system itself. In modern computing, it is common for several different storage devices to be attached to the same computer.

Files can have very different data structures but can all be accessed by the same methods built into the file system. The arrangement of data within the file is then decided by the program creating it. The file systems also store several attributes for the files within it.

All user-accessible files have names. Most current file systems use a unique name, a period, and an extension. The term ‘bob’ identifies the file ‘bob.jpg’ as a jpeg picture file. The file extension tells the OS how to open the file. The OS stores file extension relationships. If a user opens ‘bob.jpg,’ the system’s

Deleting Files

File systems also allow you to delete files. To do this, it needs to know the name and path of the file. To delete a file, the system simply removes its entry from the directory structure. It adds all the space it previously occupied to the free space list (or whatever other free space management system it uses).

These are the most basic operations required by a file system to function correctly. They are present in all modern computer file systems, but their functions may vary. For example, performing the delete file operation in a current file system like NTFS with file protection built into it would be more complicated than operating in an older file system like FAT. Both plans would check to see whether the file was in use before continuing. NTFS would then have to check whether the user currently deleting the file has permission to do so.

Some file systems also allow multiple people to open the same file simultaneously, so they have to decide whether users have permission to write a file back to the disc if other users currently have it open. If two users have read and been given permission to share a file, should one be allowed to overwrite it while the other still has it available? Or, if one user has read-write permission and another only has read permission on a file, should the user with write permission be allowed to overwrite it if there is no chance of the other user also trying to do so?

File systems offer several access mechanisms. Sequential file access is the easiest. This accesses a file record by record from the beginning. To modify a file’s location, rewind, forward, or reset to the beginning. This access mechanism is based on tape drive file storage systems but works on sequential and random-access devices (like hard drives). This approach is simple and appropriate for media playback, but inefficient for database maintenance.

Direct access is a more modern approach that better facilitates reading tasks that aren’t likely to be sequential. Direct access allows records to be read or written over in any order the application requires. This method of allowing any part of the file to be read in any order is better suited to modern hard drives, as they also allow any part of the file to be read in any order with little reduction in transfer rate.

On top of storing and managing files on a drive, the file system also maintains a system of directories in which the files are referenced. Modern hard drives store hundreds of gigabytes. The file system helps organise this data by dividing it up into directories. A directory can contain files or multiple directories. Like files, there are several basic operations that a file system needs to be able to perform on its directory structure to function correctly.

It must produce files. This is addressed by the file operation overview, but creating the file must be added to the directory structure. When a file is erased, its space becomes free. The file itself must also be deleted. Renaming files is possible. This modifies the directory structure, but not the file. Directory. The user needs know all the disc’s folders to utilise it successfully. The user must also be able to navigate hard disc folders.

Since the earliest directory structures were created, they’ve changed significantly. All files were on the same level before directory hierarchies. This system has one file directory. Two-level directories are the next step, or initial directory structure. One level of directories is listed. These folders hold files. This lets users and apps isolate their files. Then emerged the first directory trees. Tree-structure folders allow guides and files to be stored. All current file systems employ tree-structured directories, although several add security.

Protection in Operating Systems

Data integrity is paramount for any file system to ensure that files remain consistent and uncorrupted. To achieve this, most modern file systems implement mechanisms such as journaling or checksums to detect and recover from errors caused by unexpected shutdowns or disk failures. These techniques help maintain data consistency and prevent data loss in case of failures.

Security features like permissions and access control lists (ACLs) are also integrated into many file systems to protect sensitive data from unauthorized access or modification. By setting permissions at various levels (user, group, others), administrators can control who can read, write, or execute files within the system.

Show More

Raj Maurya

Raj Maurya is the founder of Digital Gyan. He is a technical content writer on Fiverr and freelancer.com. When not working, he plays Valorant.

Leave a Reply

Back to top button