0% found this document useful (0 votes)
42 views20 pages

OS Presentation

The document discusses various directory structures in operating systems, highlighting their hierarchical organization for efficient file management. It details five types: single-level, two-level, tree-structured, acyclic graph, and general graph directories, each with its advantages and disadvantages. The conclusion emphasizes the importance of these structures in modern computing environments.

Uploaded by

glsuniversity789
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views20 pages

OS Presentation

The document discusses various directory structures in operating systems, highlighting their hierarchical organization for efficient file management. It details five types: single-level, two-level, tree-structured, acyclic graph, and general graph directories, each with its advantages and disadvantages. The conclusion emphasizes the importance of these structures in modern computing environments.

Uploaded by

glsuniversity789
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Directory

Structure
Presented by:

Parth J. Patel (55)

Aarjav Sheth (73)


INTRODUCTIO

N
Directory structures in an operating system provide a hierarchical
organization for storing and managing files and directories.

• They typically start with a root directory and allow for efficient data
access, organization, and navigation, simplifying file management
and access control.

• Directory structures are essential for modern computing


environments.
What is Directory Structure
•in
On a OS?
computer, a directory is used to store, arrange, and segregate
files and folders. It is similar to a telephone directory in that it just
contains lists of names, phone numbers, and addresses rather than the
real papers. It uses a hierarchical structure to organized files and
directories.

• Directory Structure in OS perform various operations such as Creating,


Searching, Deleting etc.
Types of Directory Structure
There are five types of Directory
Structure In OS

1. Single – Level Directory


2.Two – level Directory
3.Tree or Hierarchical Directory
4.Acyclic Graph Directory
5.General Graph Directory
Single-Level Directory
Structure
• The single-level directory is the simplest
directory structure. In this directory structure, all
the files are contained under the same directory
which is called the root directory.

• In this structure, no two files can have the


same name, even if they belong to different users
or programs. There is no way to segregate
• The pictorial representation of a single-level directory. There
is only one directory (root directory), and all the files are
stored in the same directory. Here f1, f2, f3, f4, f5 represent
the five different files.
 Advantages of single-level directory
• The main advantage of a single-level directory is that it is very simple to
implement.
• Since all the files are present in the same directory, in case the number
of files is less, then searching for a particular file is faster and easier.
• Simple operations like file creation, search, deletion, and updating are
possible with a single-level directory structure.
• The single-level directory is easier to understand in practical life.

 Disadvantages of single-level directory


• In case we want to organize the files in some groups, it is not possible to
do so since we cannot create subdirectories.
• Two file names cannot be the same. In case two files are given the same
name, the previous one is overridden.
• If the number of files is very large, searching a particular file is very
inefficient.
• Segregation of important and unimportant files is not possible.
Two-Level Directory
Structure
• We saw how the single-level directory proves to be inefficient if multiple
users are accessing the system. If two different users wanted to create a file
with the same name (say report.doc), it was not allowed in a single level
directory.

• In a two-level directory structure, there is a master node that has a separate


directory for each user. Each user can store the files in that directory. It can
be practically thought of as a folder that contains many folders, each for a
particular user, and now each user can store files in the allocated directory
just like a single level directory.
• The pictorial representation of a two-level directory. For every user, there
is a separate directory. At the next level, every directory stores the files
just like a single-level directory. Although not very efficient, the two-level
directory is better than a single-level directory structure.
 Advantages of two-level directory
• Searching is very easy.
• There can be two files with the same name in two different user
directories. Since they are not in the same directory, the same name
can be used.
• Grouping is easier.
• A user cannot enter another user’s directory without permission.
• Implementation is easy.

 Disadvantages of two-level directory


• One user cannot share a file with another user.
• Even though it allows multiple users, still a user cannot keep two
same type files in a user directory.
• It does not allow users to create subdirectories.
Tree-Structured Directory
Structure
• This type of directory is used in our PCs. The biggest disadvantage of a two-level
directory was that one could not create sub-directories in a directory. The tree-structured
directory solved this problem. In a tree-structured directory, there is a root directory at
the peak.

• The root directory contains directories for each user. The users can, however, create
subdirectories inside their directory and also store the files.

• This is how things work on our PCs. We can store some files inside a folder and also
create multiple folders inside a folder.
• The pictorial representation of a tree-structured directory. The root directory is
highly secured, and only the system administrator can access it. We can see
how there can be subdirectories inside the user directories. A user cannot
modify the root directory data. Also, a user cannot access another user's
directory.
Advantages of tree-structured directory
• Highly scalable compared to the previous two types of
directories.
• Allows subdirectories inside a directory.
• Searching is easy.
• Allows grouping.
• Segregation of important and unimportant files is easy.

Disadvantages of tree-structured
directory
• As one user cannot enter another user’s directory, this
restricts sharing of files.
• Too many subdirectories may make the search
complicated.
• Users cannot modify the root directory’s data.
• Files might have to be saved in multiple directories in
Acyclic Graph Directory
Structure
• Suppose there is a file abcd.txt. Out of the three types of directories we studied
above, none of them provide the flexibility to access the file abcd.txt from multiple
directories, i.e., we cannot access a particular file or subdirectory from two or more
directories. The file or the subdirectory can be accessed only by the directory it is
present inside.

• The solution to this problem is presented by the acyclic-graph directory. In this type
of directory, we can access a file or a subdirectory from multiple directories. Hence
files can be shared between directories. It is designed in such a way that multiple
directories point to a particular directory or file with the help of links.
• A practical example of this is a doc file shared between two users. If any of
the users makes a change in the file, the change is reflected for both the
users.
 Advantages of acyclic- graph directory
• Allows sharing of files or subdirectories from more than
one directory.
• Searching is very easy.
• Provides more flexibility to the users.

 Disadvantages of acyclic-graph
directory
• Harder to implement in comparison to the previous
three.
• Since the files are accessed from multiple directories,
deleting a file may cause some errors if the user is not
cautious.
General-Graph Directory
Structure
• This is an extension to the acyclic-graph
directory. In the general-graph directory, there
can be a cycle inside a directory.

• In this image, we can see that a cycle is formed


in the user 2 directory. Although it provides
greater flexibility, it is complex to implement
this structure.
 Advantages of General-graph
directory
• Compared to the others, the General-Graph
directory structure is more flexible.
• Cycles are allowed in the directory for general-
graphs.

• Disadvantages of General-graph
directory
• It costs more than alternative solutions.
• Garbage collection is an essential step here.
Conclusio
n
• Single-level directory, two-level directory, tree-structured directory, acyclic-
graph directory, and general-graph directory are various structures of a
directory.

• In a single-level directory, all the files are stored in a single directory.

• In a two-level directory structure, there are user directories, and each user
can store files in their own directory.

• A tree-structured directory is used in real-life practice. It allows the creation of


subdirectories.

• General-graph directory allows a cycle within a directory, but the acyclic-


graph directory does not.
Thank
You

You might also like