What are the different file access methods (sequential, direct, indexed)?

Last updated 5 July 2026

File access methods define how a program reads and writes the bytes of a file: sequentially in order, directly to any position, or through an index that locates records.

  • Sequential access:

    • Read/write in linear order; a pointer advances automatically with each operation.

    • Simplest and natural for tapes, logs, and streaming; jumping around is inefficient.

  • Direct (relative) access:

    • File is a numbered set of fixed-length blocks/records; you can jump to any block by number.

    • Ideal for databases and random lookups; implemented with an explicit seek/offset.

  • Indexed access:

    • An index maps a key to the block containing that record; you search the index, then do direct access.

    • Built on top of direct access; large files may need a multi-level index. Common in database and mainframe file systems.

  • https://www.youtube.com/watch?v=0vno0Ra0wEg
  • https://www.tutorialspoint.com/article/file-access-method
  • https://www.geeksforgeeks.org/operating-systems/file-access-methods-in-operating-system/
  • https://mushfequr1984.medium.com/file-system-in-operating-system-a-brief-overview-3260a85454e4
  • https://cse.poriyaan.in/topic/file-access-methods-50820/
  • https://www.scaler.com/topics/file-access-methods-in-os/
All Operating Systems interview questions