
- OS - Home
- OS - Needs
- OS - Overview
- OS - History
- OS - Components
- OS - Structure
- OS - Architecture
- OS - Services
- OS - Properties
- OS - TAT & WAT
- OS Processes
- OS - Processes
- OS - Process Scheduling
- OS - Scheduling Algorithms
- FCFS Scheduling Algorithm
- SJF Scheduling Algorithm
- Round Robin Scheduling Algorithms
- HRRN Scheduling Algorithms
- Priority Scheduling Algorithms
- Multilevel Queue Scheduling
- Context Switching
- Operations on Processes
- Lottery Process Scheduling
- Predicting Burst Time SJF Scheduling
- Race Condition Vulnerability
- Critical Section Synchronization
- Mutual Exclusion Synchronization
- Process Control Block
- Inter Process Communication
- Preemptive and Non-Preemptive Scheduling
- Operating System - Deadlock
- Introduction to Deadlock in Operating System
- Conditions for Deadlock in Operating System
- OS Synchronization
- Operating System - Process Synchronization
- Operating System - Critical Section
- Operating System - Semaphores
- Operating System - Counting Semaphores
- Operating System - Mutex
- Operating System - Lock Variable in Process Synchronization
- Operating System - Turn Variable in Process Synchronization
- Operating System - Bounded Buffer Problem
- Operating System - Reader Writer Locks in Process Synchronization
- Operating System - Test Set Lock in Process Synchronization
- Operating System - Peterson Solution in Process Synchronization
- Operating System - Monitors in Process Synchronization
- Operating System - Sleep and Wake in Process Synchronization
- OS Memory Management
- OS - Memory Management
- OS - Virtual Memory
- OS Storage Management
- File Systems in Operating System
- Linked Index Allocation in Operating System
- Indexed Allocation in Operating System
- Structures of Directory in Operating System
- File Attributes in Operating System
- Operating System - Page Replacement
- Operating Systems - Thrashing
- Belady’s Anomaly in Page Replacement Algorithms
- Optimal Page Replacement Algorithm
- Operating System - Types
- Types of Operating System
- Batch Processing Operating System
- Multiprocessing Operating System
- Hybrid Operating System
- Monolithic Operating System
- Zephyr Operating System
- Nix Operating System
- Blackberry Operating System
- Garuda Operating System
- Tails Operating System
- Clustered Operating System
- Haiku Operating System
- AIX Operating System
- Solus Operating system
- Tizen Operating System
- Bharat Operating System
- Fire Operating System
- Bliss Operating System
- VxWorks Operating System
- Embedded Operating System
- Single User Operating System
- OS Miscellaneous
- OS - Multi-threading
- OS - I/O Hardware
- OS - I/O Software
- OS - Security
- OS - Linux
- OS Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
Structures of Directory in Operating System
A directory in operating system is a special type of container/folder which is used to store multiple files and folder in an organized manner. Or we can say that it serves as a container that can hold both files and other directories (subdirectories), creating a hierarchical organization. Directories help users and programs efficiently access, store, and organize data on storage devices like hard drives or SSDs. The hierarchical structure of directories starts from a root directory, making it easier to locate files and maintain order in the file system.
What is Structure of Directory in Operating System?
The structure of a directory in an operating system refers to the way files and directories are organized within the file system. It defines how data is stored, accessed, and managed on a storage device. A well-designed directory structure ensures efficient file organization, easy navigation, and scalability for growing data. Common directory structures include single-level, two-level, hierarchical, and graph-based systems, each catering to different needs and complexity levels. The choice of structure directly impacts the performance and usability of the operating system.
Type of Directory Structure
Operating System provide various type of directory structures and they are:
Single-Level Directory
Two-Level Directory
Tree Structure or Hierarchical Structure
Acyclic Graph Structure
General-Graph Structure
Single-Level Directory
A single-level directory is the simplest type of directory structure in an operating system. In this structure, all files are stored in a single directory, and there are no subdirectories. Both users and the system share the same directory space.
Features of Single Level Directory
Every file is stored at the same level.
There is no hierarchy or grouping of files.
Files are identified by unique names.
Two-Level Directory
A two-level directory structure is a step up from the single-level directory and provides a basic separation of files for different users. In this structure, there is a master directory (or root directory) that contains separate user directories, and each user directory stores the files specific to that user. This approach resolves some of the issues of the single-level directory, such as name conflicts and lack of organization, by isolating files for each user.
Features of Two-Level Directory
Each user has their own directory, ensuring file organization and privacy.
File names only need to be unique within a user's directory, not across the entire system.
Permissions can be set at the directory level to restrict access to files between users.
Files are logically grouped under user directories, providing better scalability and management.
A single master directory keeps track of all user directories.
Tree Structure or Hierarchical Structure
A tree structure or hierarchical directory structure is a widely used directory organization system in modern operating systems. In this structure, directories are organized in a tree-like hierarchy, with a root directory at the top and subdirectories branching out beneath it. Each directory can contain files and other directories (subdirectories), allowing for efficient organization and scalable storage. This structure is particularly useful for multi-user systems or systems with a large number of files, as it supports logical grouping, ease of navigation, and modular organization.
Features of Tree Structure or Hierarchical Structure
All files and directories are organized under this root.
Directories within directories, allowing for a deeper level of organization.
Files and directories can be accessed using absolute paths (starting from the root) or relative paths (based on the current directory).
Related files are stored within the same directory or subdirectory, enabling better organization.
Permissions can be assigned to individual directories or files, controlling who can read, write, or execute them.
The structure can grow dynamically, allowing for efficient organization as the number of files increases.
Acyclic Graph Structure
The acyclic graph structure is an advanced directory organization system used in operating systems to allow files and directories to belong to multiple parent directories. It is an extension of the tree structure, but unlike a strict tree, it permits shared subdirectories or files by using links. This creates a directed acyclic graph (DAG), where there are no cycles, and each file or directory can be accessed from multiple paths. This structure is commonly used in systems where file sharing and efficient data organization are important. It enables multiple users or programs to share the same files without duplicating them.
Features of Acyclic Graph Structure
Files or directories can belong to more than one parent directory through links (e.g., symbolic links in Unix/Linux or shortcuts in Windows).
The structure ensures that there are no loops or circular references, which could lead to infinite navigation.
Allows users to share files and directories without duplication, saving storage space.
Enables logical grouping and reuse of files across different locations.
Files and directories can be accessed via multiple paths, offering flexibility for users and programs.
Avoids duplication of data by using links instead of creating separate copies of shared files.
General-Graph Structure
The general-graph directory structure is a more flexible and complex directory organization system that allows files and directories to be connected in any arbitrary manner. Unlike the acyclic graph structure, it does not restrict connections to being acyclic, meaning cycles (loops) are allowed in this structure. This flexibility enables files and directories to have multiple parent directories or relationships, providing powerful sharing and organization capabilities. However, this structure introduces challenges such as managing cycles and ensuring efficient navigation and access control. It is rarely used in practice due to these complexities and is more of a theoretical concept or used in specialized systems.
Features of General-Graph Structure
Files and directories can have multiple links (hard or symbolic), with no restriction on forming loops.
Files and subdirectories can be shared across multiple parent directories, allowing efficient reuse without duplication.
The system uses reference counting to track how many directories or files point to a given file or directory.
Multiple paths can lead to the same file or directory, enhancing access options.
The presence of cycles can complicate directory traversal, requiring algorithms to detect and handle loops to prevent infinite navigation.
Allows complex relationships between files and directories.