File Management: File System Concepts, Attributes, Operations, Types & Access Methods
1. Concept of a File and File System
From a user’s perspective, the File System is the most visible part of an Operating System.
- What is a File? A File is a named collection of related information (programs or data) that is recorded on non-volatile secondary storage (such as a Hard Disk, SSD, or USB Pen Drive).
- What is a File System? The mechanism and data structures used by the Operating System to control how data is stored, organized, named, protected, and retrieved on a storage disk. Without a File System, data on a disk would just be one giant unorganized stream of billions of
0s and1s!
2. File Attributes (File Metadata)
Every file has a set of properties stored inside the directory structure on disk called File Attributes:
Figure 5.1: The 7 Standard Attributes of a File in an Operating System
1. Name
Human-readable symbolic file name (e.g.,
syllabus.pdf)2. Identifier (Inode)
Unique internal number tag that identifies the file inside the OS
3. Type
Indicates file format (e.g.,
.txt, .exe, .jpg)4. Location
Pointer to the device and exact starting block address on the disk
5. Size
Current size of the file in bytes, kilobytes, or blocks
6. Protection
Access control permissions: Who can Read (R), Write (W), or Execute (X)
- Time, Date, and User Identification: Stores timestamps for Creation, Last Modification, and Last Access, along with the Owner ID (crucial for security and usage monitoring).
3. Basic File Operations (6 Standard Operations)
An Operating System provides System Calls to perform 6 basic operations on any file:
- Creating a File (
create): Two steps happen: (a) Free space for the file is found in the file system, and (b) A new entry for the file is made in the Directory. - Writing a File (
write): Requires a system call specifying the file name and the data to be written. The OS maintains a Write Pointer pointing to the location in the file where the next write is to take place. - Reading a File (
read): Reads bytes from the file into a RAM buffer. The OS maintains a Read Pointer (or a single Current-File-Position Pointer) that advances automatically after every read. - Repositioning Within a File (
seek): Searches the directory entry and sets the Current-File-Position Pointer to a given byte value without performing any actual Disk I/O! - Deleting a File (
delete): Searches the directory for the named file, releases all disk space (blocks) allocated to that file so other files can reuse them, and erases the directory entry. - Truncating a File (
truncate): Erases the contents of the file (resets file length to0 bytes) while keeping all its attributes (name, owner, permissions) intact!
(Other composite operations include open(), close(), rename(), and append()).
4. File Types, Functions & Types of File Systems
A. Common File Types (By Extension)
| File Category | Common Extensions | Purpose & Internal Format |
|---|---|---|
| 1. Executable | .exe, .com, .bin, none (UNIX) |
Ready-to-run machine code program loaded into RAM. |
| 2. Source Code | .c, .cpp, .java, .py, .html |
Human-written source code in ASCII/Unicode text. |
| 3. Object File | .obj, .o, .class |
Compiled binary machine/bytecode not yet linked. |
| 4. Text / Document | .txt, .doc, .pdf, .rtf |
Textual data and formatted office documents. |
| 5. Archive / Compressed | .zip, .rar, .tar, .jar |
Multiple files grouped and compressed into one file. |
| 6. Multimedia | .mp3, .mp4, .jpg, .png, .mkv |
Binary audio, video, and image data streams. |
B. Core Functions of a File System
- Tracking free and allocated disk blocks (using Bitmaps or Linked Lists).
- Maintaining Directory Structures and mapping file names to physical disk blocks.
- Providing File Access Methods (Sequential, Direct, Indexed).
- Enforcing File Protection, Permissions, and Crash Recovery (Journaling).
C. Types of File Systems Used in Modern OS
- FAT32 / exFAT (File Allocation Table): Simple file system used in USB drives, SD cards, and older Windows versions.
- NTFS (New Technology File System): Default file system of modern Microsoft Windows; supports journaling (crash recovery), file encryption, compression, and massive file sizes.
- ext3 / ext4 (Extended File System): Default journaling file system of Linux.
- APFS (Apple File System) / HFS+: Default file system for macOS and iOS, optimized for SSDs.
- Network / Distributed File Systems (NFS, SMB): Allows files stored on a remote server to be accessed over a LAN as if they were local.
5. File Access Methods (Sequential, Direct & Indexed)
How does a program read information stored inside a file? Your DAVV syllabus highlights 3 File Access Methods (a guaranteed 5- to 8-mark question!):
Figure 5.2: The Three File Access Methods in Operating Systems
1. Sequential Access
Reads records strictly one after another in order: Record 1 → 2 → 3 (Like a Cassette Tape)
2. Direct (Random) Access
Jumps directly to ANY block N in any order without reading previous blocks (Like a DVD / SSD)
3. Indexed Access
Looks up a key in an in-memory Index Table first, then follows the pointer directly to the disk block
1. Sequential Access Method
- How It Works: The simplest and most common access method. Information in the file is processed strictly in order, one record after another, from beginning to end.
- To read Record 50, you must first read or skip through Records 1 to 49!
- Analogy: An old Magnetic Audio Cassette Tape.
- Operations:
read next(reads current record and advances pointer by +1),write next(appends to end of file), andrewind(resets pointer to beginning). - Used By: Compilers, Text Editors, Log files.
2. Direct Access (or Relative / Random Access) Method
- How It Works: A file is viewed as a numbered sequence of fixed-length logical blocks or records (
Block 0, Block 1, Block 2...). - Programs can read or write ANY block rapidly in any arbitrary order! For example, you can read
Block 14, then jump straight toBlock 53, and then writeBlock 7without touching the blocks in between! - Analogy: Playing track 8 directly on a Music CD / Spotify playlist.
- Operations:
read nandwrite n(where n is the relative block number). - Used By: Database Management Systems (DBMS) and Airline/Railway Reservation Systems where instant record lookup is required!
3. Indexed Access Method (Other Access Methods)
- How It Works: Built on top of Direct Access! An Index File (just like the Index at the back of a textbook) is created that contains Keys (e.g.,
Roll NumberorAadhaar Number) along with Pointers to the exact disk blocks where those records are stored. - To find a student record in a huge 10-million-row file, the OS first searches the compact Index (using fast binary search) and then uses the pointer to perform a Direct Access straight to the exact disk block!
- For massive files, systems use ISAM (Indexed Sequential Access Method)—a Master Index pointing to a Secondary Index, which points to the actual data blocks!
💡 Exam Preparation Tips for DAVV BCA
- When asked about File Access Methods, always compare Sequential Access (Cassette Tape analogy —
read next/write next) vs Direct Access (Disk/Database analogy —read n/write n) vs Indexed Access (Textbook Index analogy). - Don’t forget to list all 7 File Attributes (
Name, Identifier, Type, Location, Size, Protection, Timestamps) and 6 File Operations (Create, Write, Read, Reposition/Seek, Delete, Truncate).