Docsity

Notes on File-System Implementation - Operating Systems | CSC 4103, Study notes of Operating Systems

Partial preview of the text

Download Notes on File-System Implementation - Operating Systems | CSC 4103 and more Study notes Operating Systems in PDF only on Docsity!

CSC 4103: Operating Systems

File-System Implementation

Sources: Operating System Concepts by Silberschatz, Galvin and Gagne.

CSC 4103: Operating Systems

Topics

 Implementation issues  Allocation Methods  Free-Space Management  Efficiency and Performance  Recovery  NFS

CSC 4103: Operating Systems Layered File System  I/O control:  Acts as a translator using device drivers and interrupt handlers.  Basic file system:  Commands device driver to read and write physical blocks  File-organization module:  Translates logical block addresses to physical block addresses  Logical file system:  Manages file-system structure, directory structure, protection and security.

CSC 4103: Operating Systems Virtual File Systems  Virtual file Systems (VFS) provide an object-oriented way of implementing multiple file systems.  VFS allows the same system call interface (the API) to be used for different types of file systems.

CSC 4103: Operating Systems File Control Block (FCB)  Storage structure consisting of information about a file:

CSC 4103: Operating Systems In-Memory Structure The in-memory structure provides file-system management and improved performance via caching:  In-memory partition table:  information about each mounted partition.  In-memory directory structure:  information about recently accessed directories.  System-wide open-file table:  copy of the FCB of each open file.  Per-process open-file table:  pointer to the entry in the system-wide open-file table.

CSC 4103: Operating Systems Directory Implementation  Linear list of file names with pointer to the data blocks.  simple to program  time-consuming to execute  Hash Table – linear list with hash data structure.  decreases directory search time  collisions – situations where two file names hash to the same location  fixed size

CSC 4103: Operating Systems Allocation Methods Allocation method refers to how disk blocks are allocated to files so that disk space is used effectively and files can be accessed quickly:  Three methods:  Contiguous allocation  Linked allocation  Indexed allocation

CSC 4103: Operating Systems Contiguous Allocation of Disk Space

CSC 4103: Operating Systems Extent-Based Systems  Many file systems use a modified contiguous allocation scheme.  Initial continuous chunk of space  Apply extra chunk of contiguous space, if needed.  Extent-based file systems allocate disk blocks in extents.  An extent is a contiguous block of disks. Extents are allocated for file allocation. A file consists of one or more extents.

CSC 4103: Operating Systems Linked Allocation (Contd.)  The directory contains a pointer to the first and last blocks of the file.  A file of five blocks might start at block 9, continue at block 16, then block 1, block 10, and finally block 25.  Each block contains a pointer to the next block

CSC 4103: Operating Systems File-Allocation Table  The table has one entry for each disk block, and is indexed by the block number.  The entry contains the block number of the next block in the file.  Unused blocks are indicated by a 0 table value.  Example: file consisting of disk blocks 271, 618 and 339.

CSC 4103: Operating Systems Indexed Allocation (Cont.)  Supports random access  No external fragmentation  Mapping from logical to physical in a file of maximum size of 256K words and block size of 512 words. We need only 1 block for index table.  Mapping from logical to physical in a file of unbounded length (block size of 512 words).  One block is not enough for index table.  Linked scheme – Link blocks of index table (no limit on size).  Multilevel index  Combined scheme

CSC 4103: Operating Systems

Combined Scheme: UNIX