File Access Methods in Operating System (original) (raw)

Last Updated : 25 Apr, 2026

File access methods are techniques used by an OS to read and write data in files. They define how information is organized, retrieved, and modified. Choosing the right method is important for performance and data management.

There are three ways to access a file in a computer system:

Sequential Access

A file access method where data is read or written **in order, one record after another, starting from the beginning. The file pointer moves forward automatically after each operation.

Sequential-Method-Access

Sequential Access Method

**Advantages of Sequential Access Method

**Disadvantages of Sequential Access Method

Direct Access Method

A file access method that allows data to be **read or written directly at any block or record, using its address (block number). It supports **random access without scanning previous records.

Direct Access Method

Direct Access Method

**Advantages of Direct Access Method

**Disadvantages of Direct Access Method

Index Sequential method

It is the other method of accessing a file that is built on the top of the sequential access method. These methods construct an index for the file. The index, like an index in the back of a book, contains the pointer to the various blocks. To find a record in the file, we first search the index, and then by the help of pointer we access the file directly.

Index-Access-Method

Index Access Method

**Advantages of Index Sequential Method

**Disadvantages of Index Sequential Method

Other Way of File Access

1. Relative Record Access

Relative record access is a file access method used in operating systems where records are accessed relative to the current position of the file pointer. In this method, records are located based on their position relative to the current record, rather than by a specific address or key value.

**Advantages of Relative Record Access

**Disadvantages of Relative Record Access

2. Content Addressable Access

Content-addressable access (CAA) is a file access method used in operating systems that allows records or blocks to be accessed based on their content rather than their address. In this method, a hash function is used to calculate a unique key for each record or block, and the system can access any record or block by specifying its key.

Keys in Content-Addressable Access

**Advantages of Content-Addressable Access

**Disadvantages of Content-Addressable Access