Page 152 - DCAP403_Operating System
P. 152

Unit 8: File Management




          4.   date of creation/of last modifi cation;                                           Notes

          5.   locking information (for the system that provide fi le/record locking).
          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.
          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 confl icts 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 fi le.
          A “pathname” is thus obtained, which uniquely identifi es the file within the whole fi le system.

                Example: The pathname for file “File-6” in Figure 8.1 is “Root-dir:Subdir-1:File-6”, where

          a colon is used to separate tree nodes.
                        Figure 8.1: Tree Representation of a Hyerarchical Directory Structure
                             Root-dir

                                           File-1

                                           File-2


                                           Subdir-1


                                                          File-1

                                                          File-6

                                            Subdir-2          Subdir-1

                                                          File-1

          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 fi les 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 fi le.



                                           LOVELY PROFESSIONAL UNIVERSITY                                   145
   147   148   149   150   151   152   153   154   155   156   157