Structures of Directory in Operating System (original) (raw)

Last Updated : 25 Apr, 2026

The operating system uses directories to track where files are stored, just like using folders to organise papers.

By using these structures, it becomes simpler to manage and navigate files on your computer.

Directory in operating system

Different Types of Directories in OS

In an operating system, there are different types of directory structures that help organise and manage files efficiently. Each type of directory has its own way of arranging files and directories, offering unique benefits and features. These are

1) Single-Level Directory

The single-level directory is the **simplest directory structure. In it, all files are contained in the same directory which makes it easy to support and understand.

A single level directory has a significant limitation, however, when the number of files increases or when the system has more than one user. Since all the files are in the same directory, they must have a **unique name. If two users call their dataset test, then the unique name rule violated.

Single Level Directory

**Advantages

**Disadvantages

2) Two-Level Directory

In a two-level directory structure, each user has a separate User File Directory (UFD) containing only their files. A Master File Directory (MFD) stores entries for all users and points to their respective UFDs, preventing filename conflicts between users.

Two Level Directory

Two-Levels Directory Structure

Advantages

Disadvantages

3) Tree Structure/ Hierarchical Structure

The tree directory structure is the most common in personal computers. It resembles an upside-down tree, with the root directory at the top containing all user directories. Each user can create files and subdirectories within their own directory but cannot access or modify the root or other users’ directories.

Tree Structure Directory

Tree/Hierarchical Directory Structure

Advantages

Disadvantages

4) Acyclic Graph Structure

In the earlier directory structures, a file could only be accessed from the directory it was stored in. The acyclic graph directory structure solves this by allowing a file or subdirectory to be shared across multiple directories using links. Changes made by one user are visible to all users sharing that file.

In the below figure, this explanation can be nicely observed, where a file is shared between multiple users. If any user makes a change, it would be reflected to both the users.

Acyclic group structure

Acyclic Graph Structure

Advantages

Disadvantages

5) General-Graph Directory Structure

Unlike the acyclic-graph directory, which avoids loops, the general-graph directory can have cycles, meaning a directory can contain paths that loop back to the starting point. This can make navigating and managing files more complex.

root_directory

General Graph Directory Structure

In the above image, you can see that a cycle is formed in the User 2 directory. While this structure offers more flexibility, it is also more complicated to implement.

**Advantages of General-Graph Directory

**Disadvantages of General-Graph Directory