Course Content
Operating Systems (OS)
File Concepts, File Types, and Access Methods

The File System is a crucial part of any operating system that allows data to be stored and retrieved in a structured, organized manner. Files are the basic units of storage, and understanding how they are defined, categorized, and accessed is fundamental to grasping how data management works at the system level.


File Concepts

A file is a logical collection of information stored on secondary storage (like a hard disk or SSD). Files can contain different kinds of data—text, images, audio, programs, or system information.

Key File Attributes:

 

  • Name – Human-readable identifier.
  • Type – Defines content or purpose (.txt, .exe, .jpg).
  • Location – Where the file is stored on disk.
  • Size – Current size of the file in bytes.
  • Permissions – Defines who can read, write, or execute the file.
  • Timestamps – Records of when the file was created, modified, or accessed.

 

Operating systems manage these attributes using file control blocks (FCBs), which store metadata about files.


File Types

File types define the format and purpose of a file. Different file types are used for different operations and are recognized by the operating system based on their extensions.

Common File Types:

File Type Extension Example Purpose
Text Files .txt, .md Store plain text data.
Binary Files .bin, .dat Store machine-readable data.
Executable Files .exe, .out Contain compiled program code.
Image Files .jpg, .png Store graphical data.
Audio/Video Files .mp3, .mp4 Multimedia content.
Source Code Files .c, .py Written in programming languages.

Some operating systems use file extensions to associate files with applications, while others store the type as part of metadata.


File Access Methods

Different applications require different ways to access file data. Operating systems support various access methods depending on the file type and purpose.

 

1. Sequential Access

  • Data is read or written in order, from beginning to end.
  • Most common and simplest access method.
  • Examples: Reading a log file, playing a music file.

Pros:

  • Simple to implement.
  • Efficient for large files that don’t need random access.

 

Cons:

  • Slow when specific data in the middle or end is needed quickly.

2. Direct Access (Random Access)

  • Allows reading or writing data at any location within the file.
  • Suitable for databases, large datasets, and indexed files.

Pros:

  • Fast access to specific parts of a file.
  • Ideal for applications that frequently update or search data.

 

Cons:

  • More complex file structure needed (e.g., indexing).

3. Indexed Access

  • Uses an index (like a table of contents) that maps keys to data locations.
  • Common in database systems and structured storage.

Pros:

  • Combines the benefits of sequential and direct access.
  • Efficient for querying large datasets.

 

Cons:

  • Requires overhead to maintain index files.

0% Complete
WhatsApp Icon

Hi Instagram Fam!
Get a FREE Cheat Sheet on System Design.

Hi LinkedIn Fam!
Get a FREE Cheat Sheet on System Design

Loved Our YouTube Videos? Get a FREE Cheat Sheet on System Design.