File Systems in Operating Systems

Share Now

File Systems in Operating Systems explains types of file allocation, file organization methods, disk components, and key operations performed by a file system in modern operating systems.

File Systems in Operating Systems

File System in Operating System

A file system is the method by which the operating system stores, organises and manages files inside the storage device, like a hard drive, SSD or pen drive, etc. It allocates & deallocates disc space. File System uses data structures like tables to keep track of the file locations.

  • File: A file is a collection of related information; it can be a program or data. The data may be numbers, letters or both. Each file has an extension like .txt, .jpg, or .exe.
  • Block: Discs are made of blocks and sectors; one block can contain one or more sectors. The OS translates block numbers into physical sector numbers to access data.
  • Disc: A disc is a secondary storage device like a hard drive or floppy disc. Hard discs store the data on platters inside the hard drive.
  • Floppy Disc: It is a magnetic plastic disc containing a file. The floppy disc has concentric circles called tracks and is divided into sectors.
  • Hard Disc: The hard disc is made of concentric tracks, and each track is divided into sectors. Each surface has its own read/write head connected to a movable arm.

Disk Timing Components

  • Seek Time: Time taken by the read/write head of the disc to move to the correct track.
  • Rotational Delay/Latency: Time taken for the desired sector of the disc to rotate under the read/write head.
  • Transmission Time: Time taken to actually transfer the data once the head is in position.

File Operationsin Operating System

File operations help to manage files, like creating, writing, reading or deleting data.

  • Create a file: Makes a new file on the disc. To create a file, a file name and extension are required.
  • Write to a file: Saves or updates data into a file.
  • Read a file: Transfers data from the file into memory.
  • Rewind a file: Rewind means moving the file pointer back to the beginning of the file.
  • Delete a file: Remove the file from the disk.

Allocation Method

When the files are stored on the disc, then the operating system has to decide how to allocate blocks of spare. There are two methods for doing the same:

1. Contiguous Allocation

In this the file occupies continuous blocks on the disc. It helps to read the file data easly but it leads to space wastage and fragmentation. It works well if the file size is predictable, but if the file size grows beyond the estimated size, then the operating system has to move the file elsewhere. When the multiple free blocks are there, then how to choose the free block depends on the method, like

  • First fit
  • Best fit
  • Worst fit

2. Non-contiguous Allocation

In non-contiguous allocation the file blocks are not stored continous on the disk. Instead they are stored in different locations. This helps the operating system to keep track of where each block is stored. There are two methods for implementing non-contiguous allocation:

  • Chained allocation (e.g. MS-DOS): In this each block contains a address (pointer) to the next block.
  • Indexed allocation (e.g., Unix): The index block stores all block addresses to the file. It allows direct access to any block. It is efficient for both sequential and random access.

A File Organization

The file organisation organised the data for storage and retrieval. It has full authority of accessibility and decision-making. It helps to improve system performance and efficiency. There are two methods for the file organisation:

1. Sequential File Organisation

Sequential means one after another. In sequential file organisation the data is stored one after another in order. The files are arranged by a key field.

Advantage of Sequential File Organisation
  • Simple to use
  • Better for sequential access
  • Good for the application where the data is processed in bulk.
Disadvantages of Sequential File Organisation
  • Work is slow for random access.
  • Insertion and deletion are difficult.
  • Not flexible for changing data

2. Direct File Organisation

In direct file organisation, records are stored and accessed using a key field. It allows direct access to any record using its physical address, which means if you want to access any record, then you can directly jump to the record directly using the physical address.

Advantage of direct file organisation
  • Very efficient for random access.
  • Helps with quick searching, updating and deleting records.
  • Suitable for large files
Disadvantages of direct file organization
  • More complex for sequential organisation
  • Collisions may occur.
  • Requires extra handling for overflow records.

Disclaimer: We have provide you with the accurate handout of “File Systems in Operating Systems“. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above study material present on our websites is for education purpose, not our copyrights.

Images and content shown above are the property of individual organisations and are used here for reference purposes only. To make it easy to understand, some of the content and images are generated by AI and cross-checked by the teachers.

cbseskilleducation.com

Leave a Comment