Files Directories in Operating System

File Directories in Operating System

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.  
Files Directories in OS

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 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.
Files Directories in Operating System single

Two Level Directory

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.

Files Directories in Operating System two

Tree-structured directory

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
Files Directories tree

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription