Files Directories in Operating System

File Directories in OS

Group of files combined is known as directory. A directory contains all information about file, its attributes. The directory can be viewed as a symbol table that translates file names into their directory entries.Directory itself can be organized in many ways.

The organization must allow us to insert entries, to delete entries, to search for a named entry, and to list all the entries in the directory. In this section, we examine several schemes for defining the logical structure of the directory system.

Types of File Directories in OS

Single Level File Directories in Operating System

Single Level Directory –All the files belong to a single directory

Advantages

  1. Easy to implement
  2. Reduced Redundancy

Disadvantages

  1. All files belong to one same directory
  2. User can’t have 2 files with same names
  3. User doesn’t have option to group files according to his/her needs.

Two Level File Directories in Operating System

Two Level Directories –

In this type of directory each user has its own directory.

In the two-level directory structure, each user has his own user file directory (UFD). The UFDs have similar structures, but each lists only the files of a single user. When a user job starts or a user logs in, the system’s master file directory (MFD) is searched. The MFD is indexed by user name or account number, and each entry points to the UFD for that user.

Advantages

  • Sharing Directory by users problem is solved
  • Efficienty
  • More secure then 1 level directory
  • Two users can have file with same name in their own directories.

Disadvantages

  • Grouping problem is still not solved, for example if user wants to create a directory group for all files that are movies or music., he cant do that
  • No two files for a single user can have same names.

Due to two levels there is a path name for every file to locate that file.

Tree Structured File Directories in Operating System (1)

Tree-structured directories:-

Directory is maintained in the form of a tree. Searching is efficient and also there is grouping capability. We have absolute or relative path name for a file.

Advantages

  • Two files can have same names now, if they are in different sub directories.
  • Grouping is also possible now

Please Login/Signup to comment