• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

File Access Methods in Operating System

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
  • Direct Access
  • Index sequential Method

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-Method-Access

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

  • The files can be immediately accessed decreasing the average access time.
  • In the direct access method, in order to access a block, there is no need of traversing all the blocks present before it.

Disadvantages of Direct Access Method

  • Complex Implementation : Implementing direct access can be complex, requiring sophisticated algorithms and data structures to manage and locate records efficiently.
  • Higher Storage Overhead : Direct access methods often require additional storage for maintaining data location information (such as pointers or address tables), which can increase the overall storage requirements.

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

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.

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

  • Unique: Each record or block has a unique key that is generated using a hash function.
  • Calculated based on content: The key is calculated based on the content of the record or block, rather than its location or address.