Module 4
Module 4
FILE DIRECTORIES
Associated with any file management system and collection of files is a file directory. The
directory contains information about the files, including attributes, location, and ownership.
Much of this information, especially those that concern storage, is managed by the operating
system. The directory is itself a file, accessible by various file management routines. Although
some of the information in directories is available to users and applications, this is generally
provided indirectly by system routines.
Concept of File Directory
To keep track of files, the file system normally provides directories, which, in many systems are
themselves files. The structure of the directories and the relationship among them are the main
areas where file systems tend to differ, and it is also the area that has the most significant effect
on the user interface provided by the file system.
Contents of File Directory
From the user’s point of view, the directory provides a mapping between file names, known to
users and applications, and the files themselves. Thus, each file entry includes the name of the
file. Virtually all systems deal with different types of files and different file organisations, and
this information is also provided.
An important category of information about each file concerns its storage, including its location
and size. In shared systems, it is also important to provide information that is used to control
access to the file.
Typically, one user is the owner of the file and may grant certain access privileges to other users.
Finally, usage information is needed to manage the current use of the file and to record the
history of its usage.
File Directory Structure
The number of directories varies from one operating system to another.
In this section, we describe the most common schemes for defining the logical structure of a
directory. These are:
1. Single-Level Directory
2. Two-Level Directory
3. Tree-Structured Directory
4. Acyclic Graph Directory
1. Single-Level Directory
In a single-level directory system, all the files are placed in one directory. This is very common
on single-user operating systems. A single-level directory has significant limitations when the
number of files increases or when there is more than one user. Since all files are in the same
directory, they must have unique names. If there are two users who call their data file
“cit381note.doc”, then the unique-name rule is violated. Even with a single user, as the number
of files increases, it becomes difficult to remember the names of all the files in order to create
only files with unique names.
The Figure 5 below shows the structure of a single-level directory system.
Fig 5: Single Level Directory
Source: Operating System Concepts with Java, 6th ed. by Abraham
Silberschatz and Others. (2004)
2. Two-Level Directory
In the two-level directory system, the system maintains a master block that has one entry for
each user. This master block contains the addresses of the directory of the users. There are still
problems with two-level directory structure. This structure effectively isolates one user from
another. This design eliminates name conflicts among users and
this is an advantage because users are completely independent, but a disadvantage when the
users want to cooperate on some task and access files of other users. Some systems simply do not
allow local files to be accessed by other users. It is also unsatisfactory for users with many files
because it is quite common for users to want to group their files
together in a logical way.