Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Access Methods, Directory & Disk Structure

Lesson 28 of 31 in the free Operating System & Linux Programming notes on Siksha Sarovar, written by Rohit Jangra.

File Access Methods

Files are stored as bytes; access methods are the patterns programs use to read them.

1. Sequential Access

Read or write bytes in order. Operations: read_next, write_next, reset. Matches tape model. Most logs and streams use this.

2. Direct (Random) Access

Treat the file as a numbered sequence of blocks; jump to block n in O(1). Required for databases and large files. lseek(fd, offset, SEEK_SET) is the system call.

3. Indexed Access

Maintain an index that maps a key (e.g., student ID) to a block. Looking up a record means searching the index then jumping to the block. Used in ISAM and many DBMS file formats.

Directory Structures

StructureDescriptionProsCons
Single-levelOne flat directorySimpleName conflicts; no per-user isolation
Two-levelOne directory per userUser isolationNo grouping below user
TreeArbitrary nested directoriesLogical organizationSearching long paths
Acyclic graphAllows shared subdirectories via linksSharingHard to delete safely
General graphAllows cyclesMaximum flexibilityNeeds cycle detection in tools like du

Linux uses a tree with hard links and symbolic links (effectively producing an acyclic graph for files).

Mounting

A filesystem must be mounted at a directory (the mount point) before its files are accessible. mount /dev/sdb1 /mnt/usb overlays the root of the new filesystem onto /mnt/usb.

Disk Structure

A disk is divided into:

  • Boot block — bootloader code.
  • Superblock — filesystem metadata (size, free counts).
  • Inode table — fixed-size array of inodes.
  • Data blocks — file contents.
  • Free-list / bitmap — tracks free blocks.

Allocation Methods

  • Contiguous — file occupies consecutive blocks. Fast random access; suffers external fragmentation.
  • Linked — each block points to the next. No fragmentation; poor random access.
  • Indexed — an index block holds pointers to all data blocks. Combines random access with no external fragmentation. Used in Unix-like inodes (with multi-level indirection).

File Protection — General

  • Access lists (ACLs) — per-user permission entries.
  • Group / role-based — Unix's owner/group/other model.
  • Capabilities — unforgeable tokens, used in microkernels.

Summary

  • Sequential, direct, and indexed access methods cover most workloads.
  • Modern systems use a tree directory with hard/symbolic links.
  • Indexed allocation (Unix inode) is the practical sweet spot for disk layout.