Page 150 - DCAP403_Operating System
P. 150

Unit 8: File Management






          Other bookkeeping information is typically associated with each file within a file system. The   Notes

          length of the data contained in a file may be stored as the number of blocks allocated for the


          file or as an exact byte count. The time that the file was last modified may be stored as the fi le’s


          timestamp. Some file systems also store the file creation time, the time it was last accessed, and


          the time that the file’s meta-data was changed.
             Note    Many early PC operating systems did not keep track of  file times. Other

             information can include the file’s device type (e.g., block, character, socket, subdirectory,

             etc.), its owner user-ID and group-ID, and its access permission settings (e.g., whether the
             file is read-only, executable, etc.).


          The hierarchical  file system was an early research interest of Dennis Ritchie of Unix fame;
          previous implementations were restricted to only a few levels, notably the IBM fame; previous
          implementations were restricted to only a few levels, notably the IBM implementations, even of

          their early databases like IMS. After the success of Unix, Ritchie extended the file system concept
          to every object in his later operating system developments, such as Plan 9 and Inferno.


          Traditional file systems offer facilities to create, move and delete both files and directories. They
          lack facilities to create additional links to a directory (hard links in Unix), rename parent links
          (“..” in Unix-like OS), and create bidirectional links to fi les.
          Traditional  file systems also offer facilities to truncate, append to, create, move, delete and


          in-place modify files. They do not offer facilities to prepend to or truncate from the beginning of


          a file, let alone arbitrary insertion into or deletion from a file. The operations provided are highly
          asymmetric and lack the generality to be useful in unexpected contexts.
                 Example: Interprocess pipes in Unix have to be implemented outside of the fi le system
          because the pipes concept does not offer truncation from the beginning of fi les.

          Secure access to basic fi le system operations can be based on a scheme of access control lists or

          capabilities. Research has shown access control lists to be difficult to secure properly, which is
          why research operating systems tend to use capabilities. Commercial file systems still use access

          control lists.
          8.3 Access Methods

          There are several ways that the information in the file can be accessed. Some systems provide only


          one access method for files. On other systems, many different access methods are supported.
          Sequential Access


          Information in the file is processed in order, one record after the other. This is by far the most

          common mode of access of files. For example, computer editors usually access files in this fashion.



          A read operation reads the next portion of the file and automatically advances the fi le pointer.

          Similarly, a write appends to the end of the file and the file pointer. Similarly, a write appends to



          the end of the file and the file pointer. Similarly, a write appends to the end of the end of the fi le


          and advances to the end of the newly written material (the new end of file). Such a file can be reset
          to the beginning, and, on some systems, a program may be able to skip forward or backward n

          records, for some integer n. This scheme is known as sequential access to a file. Sequential access
          is based on a tape model of a fi le.

          A sequential  file may consist of either formatted or unformatted records. If the records are
          formatted, you can use formatted I/O statements to operate on them. If the records are
                                           LOVELY PROFESSIONAL UNIVERSITY                                   143
   145   146   147   148   149   150   151   152   153   154   155