***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Sunday, April 5, 2020

Directory Structure - Types


Directory Structure


A disk can be used in its entirety for a file system.

Alternatively a physical disk can be broken up into multiple partitions, slices, or mini-disks, each of which become a virtual disk and can have its own filesystem. ( or be used for raw storage, swap space, etc. ). Or, multiple physical disks can be combined into one volume, i.e. a larger virtual disk, with its own filesystem spanning the physical disks.

Directory Overview

A directory is a container that is used to contain folders and file. It organizes files and folders into a hierarchical manner.

Directory operations to be supported include:

·         Search for a file

·         Create a file - add to the directory

·         Delete a file - erase from the directory

·         List a directory - possibly ordered in different ways.

·         Rename a file - may change sorting order

·         Traverse the file system.

1.      Single-Level Directory

Simple to implement, but each file must have a unique name.

2.      Two-Level Directory

·         Each user gets their own directory space.

·         File names only need to be unique within a given user's directory.

·         A master file directory is used to keep track of each users directory, and must be maintained when users are added to or removed from the system.

·         A separate directory is generally needed for system ( executable ) files.

·         Systems may or may not allow users to access other directories besides their own

o    If access to other directories is allowed, then provision must be made to specify the directory being accessed.

o    If access is denied, then special consideration must be made for users to run programs located in system directories. A search path is the list of directories in which to search for executable programs, and can be set uniquely for each user.

3.      Tree-Structured Directories

·         Each user / process has the concept of a current directory from which all ( relative ) searches take place.

·         Files may be accessed using either absolute pathnames ( relative to the root of the tree ) or relative pathnames ( relative to the current directory. )

·         Directories are stored the same as any other file in the system, except there is a bit that identifies them as directories, and they have some special structure that the OS understands.


4.      Acyclic-Graph Directories

When the same files need to be accessed in more than one place in the directory structure ( e.g. because they are being shared by more than one user / process ), it can be useful to provide an acyclic-graph structure. 

UNIX provides two types of links for implementing the acyclic-graph structure.

·         hard link ( usually just called a link ) involves multiple directory entries that both refer to the same file. Hard links are only valid for ordinary files in the same filesystem.

·         symbolic link, that involves a special file, containing information about where to find the linked file. Symbolic links may be used to link directories and/or files in other filesystems, as well as ordinary files in the current filesystem.

Windows only supports symbolic links, termed shortcuts.

5.      General Graph Directory

In general graph directory structure, cycles are allowed within a directory structure where multiple directories can be derived from more than one parent directory.
The main problem with this kind of directory structure is to calculate total size or space that has been taken by the files and directories.







No comments:

Post a Comment