Directory Structure in OS | Types of directory structures

By:   Last Updated: in: ,

Operating System: Q1.Directory Structure in OS? - Types of Directory Structures (Operating System all notes) [ Topic= Directory Structure in OS ]


Q1. Why is Directory Structure needed for files? Or Describe the Directory Structure in OS? with example? Types of Directory Structures?

Ans. Directory Structure: Directories are considered as the symbolic tables of the file that store all the related information about the file, with the content. This information includes hile attributes, location, type, and access privileges. Directories are also known as containers for the files. The directory is itself a file that is owned by the operating system.

There are millions of files present in the system that needed to be managed. Directories provide a means to organize files in a structure. Each entry in a directory contains information about a file.

Following operations can be performed on these entries :
1. Searching a File: Whenever a file is referenced, the directory must search for the related entry.
2. Create a File: An entry for every newly created file needs to be added in the directory.
3. Delete a File: Whenever a file is deleted, the related entry should be removed from the directory.
4. List Directory: List of files in a directory should be known whenever a user requests for it.
5. Rename a File: The name of the file should be changeable when the use of file changes or its location changes.
6. Update Directory: Whenever a file attribute changes, its corresponding entry needs to be updated

On the basis of these entries and their operations, structure for directories can be organized in different ways. The three most common structures for organizing directories are single level, two-level, and hierarchical structure.
[ Topic= Directory Structure in OS ]

1. Single-Level Structure: Directory Structure in OS

It is the most simplest form of directory structures having only one level of directories. All the files are contained in the same directory. The directory structure was implemented in the old versions of the single-user system. It becomes outdated and inadequate in a multiple user system.

For every single user, it is difficult to keep track of the files, if the number of files increases. Moreover, files are of different types such as graphic files, text files, and executable files and if a user wants to arrange these files in an organized manner such as group files by type, this structure becomes inconvenient.

2. Two-Level Structure: Directory Structure in OS

As the name suggests, this structure is divided into two levels of directories, a master directory and user directories as subdirectories of the master directory. A separate directory is provided to each other and all these directories are contained and indexed in a master directory. A user directory represents a list of the files of a specific user.

1. The two-level structure looks like an inverted tree of height.
2. The root of this tree is a master directory having user directories as its branches. Files are the leaves of these branches.
A user name and the file name is the pathname for a file. This structure solves the problem of unique names up to a certain extent, a user can assign duplicate names to files, provided the files are present in different directories.
The names need to be unique in the user's own directory because the names of two files can't be the same in a single directory. A user searches a file in his own directory only, which allows different users to have files with the same names.

3. Hierarchical Structure:

This is the most powerful and flexible structure and is implemented in almost every operating system. The two-level structure is extended into the more advanced hierarchical structure of arbitrary levels. It uses the concept of the two-level structure of the master directory having user directories as subdirectories. In addition, each user directory, in turn, has sub-directories and files as its branches and leaves.
Users can create their own sub-directories to organize files of different types such as, a separate sub-directory for graphic files or a separate sub-directory for text files. Special system calls are used to create or delete directories. Internal format, which is the internal structure in which the details of a directory are stored, of each directory, has an entry that stores a special bit representing a sub-directory or a file, 0 bit represents a file and 1 bit represents a directory.

[ Topic= Directory Structure in OS ]
[ Topic= Directory Structure in OS ]
[ Topic= Directory Structure in OS ]

Join us on Facebook, Instagram, and Twitter to get the latest study material. You can also ask us any questions.
Facebook = @allbcaweb
(click on it or search "allbcaweb" on Facebook)
Instagram = @allbcaweb
(click on it or search "allbcaweb" on Instagram)
Twitter = @allbcaweb
(click on it or search "allbcaweb" on Twitter)
Send us your query anytime about Directory Structure in OS!

External Links:-

1. Directory Structure in OS - (click here)
2. Directory Structure in OS - (click here)

[ Topic= Directory Structure in OS ]
[ Topic= Directory Structure in OS ]

No comments:
Write comment