next up previous contents Back to Operating Systems Home Page
Next: File Management - III Up: File Management - II Previous: Hashed



As particular case of indexing, to the file system of any file management system is associated a file index consisting of a directory or set of directories.

The directories themselves are simply files indexing other files, which may in turn be directories if a hyerarchical indexing scheme is used. In order to protect the integrity of the file system in spite of user of program error, all modifications to these particular directory files are commonly restricted to the file management systemgif. The typical contents of a directory are:

As far as organization, by far the most common scheme is the hyerarchical one: a multi-level indexing scheme is used, in which a top-level directory indexes both files and other directories, which in turn index files and directories, and so on. Usually this scheme is represented in the form of a tree, see fig. 14

Figure 14: Tree representation of a hyerarchical directory structure.

The hyerarchical architecture has disctinct advantages over a simple, one-level indexing one: the tree structure can be effectively used to reflect a logical organization of the data stored in the files; names can be reused (they must uniquely identify files within each directory, not across the whole fle system); in a multi-user system, name conflicts between files owned by different users can be solved by assigning to each user a directory for her own files and sub-directories, the so called user's ``home'' directory.

A complete indexing of a file is obtained by navigating the tree starting from the top-level, ``root'', directory, and walking along a path to the tree leaf coresponding to the file. A ``pathname'' is thus obtained, which uniquely identifies the file within the whole file system. For example, the pathname for file ``File-6'' in fig. 14 is ``:Root-dir:Subdir-1:File-6'', where a colon is used to separate tree nodes.

A complete pathname is not the only way to identify a file in the directory tree structure: a ``relative'' pathname, starting from a parent directory is suited just as well, provided that the FMS already knows about that directory. This addressing methods can be usefully exploited by making the FMS assign to all processes a ``current working directory'' (CWD) attribute, i.e. the complete patname of a directory of interest, and defining a way for the process to identify files by just specifying a ``relative'' pathname starting from that directory. In the same example, if ``:Root-dir:Subdir-1'' is the CWD of a process, the above file might be identified simply as ``File-6'', using the convention that patnames not starting with a color are relative to the CWD. The advantage is twofold: the entire file system structure up to the CWD need not be known by a program (hence its data can be safely moved in other directories withouth having to rewrite the program), and file access time is decreased, since it's no longer necessary to navigate the whole tree in order to find the address of a file.

next up previous contents Back to Operating Systems Home Page
Next: File Management - III Up: File Management - II Previous: Hashed

Franco Callari