os202

OS202

View on GitHub

HOME


Top 10 List of Week 03

  1. File
    File is a named collection of related information that is recorded on a secondary storage. Files can be numeric, character, or binary. The content of it is defined by the file’s creator and user.

  2. File Operation
    The operating system can provide system calls to create, write, read, reposition, delete, and truncate files.
    • create
      Two steps are necessary to create a file. First, space in the file system must be found for the file. Second, an entry for the new file must be made in a directory.
    • write
      The OS maintains a write pointer for every file which points to the position in the file from which, the data needs to be written.
    • read
      A Read pointer is maintained by the OS, pointing to the position up to which, the data has been read.
    • reposition
      Re-positioning is simply moving the file pointers forward or backward depending upon the user’s requirement.
    • delete
      Deleting the file will not only delete all the data stored inside the file, It also deletes all the attributes of the file. The space which is allocated to the file will now become available and can be allocated to the other files.
    • truncate files
      Truncating is deleting the file except deleting attributes. The file is not completely deleted although the information stored inside the file get replaced.
  3. File Types
    The types of files recognized by the system are either regular, directory, or special. However, the operating system uses many variations of these basic types.
    • regular
      Stores data (text, binary, and executable).
    • directory
      Contains information used to access other files.
    • special
      Defines a FIFO (first-in, first-out) pipe file or a physical device.
  4. File Access Methods
    • Sequential Access Method
      the information in the file is processed in order, one record after another. For example, compiler and various editors access files in this manner. The read-next reads the next portion of a file and updates the file pointer which tracks the I/O location. Similarly, the write-next will write at the end of a file and advances the pointer to the new end of the file. The sequential access always reset to the beginning of the file and then starts skipping forward or backward n records. It works for both sequential devices and random-access devices.
    • Direct Access Method
      For direct access, the file is viewed as a numbered sequence of blocks or records. This method is based on the disk model of file. Since disks allow random access to file block. We can read block 42, then read 45, and write in block 59, there is no restriction on the order of access to the file. The direct access method is used in database management.
  5. Directory Structure
    • Single-level directory
      Single level directory is simplest directory structure. In Single level directory, all files are contained in same directory.
    • Two-level directory
      In the two-level directory structure, each user has there own user files directory (UFD). The UFDs has similar structures, but each lists only the files of a single user.
    • Tree-structured directory
      Tree-structured directory allows the user to create there own subdirectories and to organize on their files accordingly. The tree has a root directory, and every file in the system have a unique path.
    • Acyclic graph directory
      An acyclic graph is a graph with no cycle and allows to share subdirectories and files. The same file or subdirectories may be in two different directories. It is a natural generalization of the tree-structured directory.
    • General graph directory structure
      In general graph directory structure, cycles are allowed within a directory structure where multiple directories can be derived from more than one parent directory.
  6. File System Structure
    File systems are organized into layers. Every layer of the file system is responsible for some activities. The layers are:
    • Application Programs
    • Logical File Systems
    • File-Organization Module
    • Basic File Systems
    • I/O Control
    • Hardware Device
  7. Directory Implementation
    Directories need to be fast to search, insert, and delete, with a minimum of wasted disk space.
    • Linear List
      A linear list is the simplest method to implement directory. In this algorithm, all the files in a directory are maintained as singly lined list. Each file contains the pointers to the data blocks which are assigned to it and the next file in the directory.
    • Hash Table
      This approach suggests to use hash table along with the linked lists. A key-value pair for each file in the directory gets generated and stored in the hash table. The key can be determined by applying the hash function on the file name while the key points to the corresponding file stored in the directory.
  8. File Allocation Methods
    There are three major methods of storing files on disks: contiguous, linked, and indexed.
    • Contiguous Allocation
      Contiguous Allocation requires that all blocks of a file be kept together contiguously.
    • Linked Allocation
      Disk files can be stored as linked lists, with the expense of the storage space consumed by each link.
    • Indexed Allocation
      Indexed Allocation combines all of the indexes for accessing each file into a common block ( for that file ), as opposed to spreading them all over the disk or storing them in a FAT table.
  9. Virtual File Systems
    Virtual File Systems, VFS, provide a common interface to multiple different filesystem types. In addition, it provides for a unique identifier ( vnode ) for files across the entire space, including across all filesystems of different types.

  10. Network File Systems
    The Network File System (NFS) is a distributed file system that allows a client computer to access files over a network as though the files were on local storage. This enables system administrators to consolidate resources onto centralized servers on the network.