




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





A File system contains thousands and millions of files, owned by several users. The directory structure organizes these files by keeping entries of all the related files. The file entries have information like file name, type, location, the mode in which the file can be accessed by other users in the system. The two important features that must be taken care while maintaining a directory are given below.
value L indicates that the file is a link, value M indicates that the file is a mounted file system. The Misc info filed in the directory contains the miscellaneous information about the owner of the file, the time of its creation, the time at which the file was modified last.
In this section, we will be discussing the most common types of directories, their benefits and drawbacks.
Single level directory structure has only one directory which is called the root directory. The users are not allowed to create subdirectories under the root directory. All the files created by the several users are present in the root directory only. As you can see in the diagram below all the file F1, F2, F3, F4 created by the different users are present at the root directory. There is one drawback of Single-level directory structure, a user cannot use the same file name used by another user in the system. Even if the file with the
Here, the files are accessed by their location using the path. There are two types of paths to locate the file in this directory structure Absolute Path Here, the path for the desired file is described by considering the root directory as the base directory. Relative Path Here, either the user’s directory is considered as the base directory or the desired file directory is considered as the base directory.
In a tree directory structure, except root directory, every directory or file has only one parent directory. So, there is a total separation between the users which provide complete naming freedom. Here, if a user wishes to access another users file, it has to go through two or more directories.
The tree directory structure provides an asymmetric way for the user to access the shared files of a different user. For example, a user can access a file of its own user directory with a shorter path than the other user.
This problem can be solved by the acyclic-graph directory structure. As this directory structure allows a directory or a file to have many parent directories. So, a shared file in a directory can be pointed by the other user directories who have access to that shared file using the links. In the diagram below you can see that the directory having file F7 and F8 have two parent directories.
3. Deleting If a file is no longer needed by the user, it can be deleted from the directory. The entire directory can also be deleted if it is not needed. An empty directory can also be deleted. When a directory is empty it is resembled by dot and dotdot. 4. List a directory List of all the files in the directory can be retrieved and also the contents of the directory entry, for each file in a list. To read the list of all the files in the directory, it must be opened and after reading the directory must be closed to free up the internal tablespace. 5. Renaming The name of the file or a directory represents the content it holds and its use. The file or directory can be renamed in case, the content inside or the use of file get changed. Renaming the file or directory also changes its position inside the directory. 6. Link The file can be allowed to appear in more than one directory. Here, the system call creates a link between the file and the name specified by the path where the file is to appear. 7. Unlink If the file is unlinked and is only present in one directory its directory entry is removed. If the file appears in multiple directories, only the link is removed.
Directory is also considered as a file that contains information about the other files and directories. Directory keeps the entry of a group of all the related files and also the information like file names, types, location, etc. The single-level directory has only one root directory and no user is allowed to create subdirectories inside the root directory.
The two-level directory allows the user to create a directory inside the root directory but do not allow creating further subdirectories. Hierarchical directory goes beyond two-level directory structure. Here, a user is allowed to create many subdirectories. In the tree directory, each directory has only one parent directory except the root directory. An acyclic graph structure, a directory can have more than one parent directory. The directories can undergo many maintenance operations like create, delete, list, rename, link, unlink, etc. The directory structure is simply a file that keeps complete information of other files or directories in the file system.