Docsity

Operating System - File System Interface - Notes, Study notes of Operating Systems

Partial preview of the text

Download Operating System - File System Interface - Notes and more Study notes Operating Systems in PDF only on Docsity!

FILE-SYSTEM INTERFACE

File-System Interface

  • (^) File Concept
  • (^) Access Methods
  • (^) Directory Structure
  • (^) File-System Mounting
  • (^) File Sharing
  • (^) Protection

File Concept

  • (^) Contiguous logical address space
  • (^) Types:
    • (^) Data
      • (^) numeric
      • (^) character
      • (^) binary
    • (^) Program

File Structure

  • (^) None - sequence of words, bytes
  • (^) Simple record structure
    • (^) Lines
    • (^) Fixed length
    • (^) Variable length
  • (^) Complex Structures
    • (^) Formatted document
    • (^) Relocatable load file
  • (^) Can simulate last two with first method by inserting appropriate control characters
  • (^) Who decides:
    • (^) Operating system
    • (^) Program

File Operations

  • (^) File is an abstract data type
    • (^) Create
    • (^) Write
    • (^) Read
    • (^) Reposition within file
    • (^) Delete
    • (^) Truncate
    • Open(Fi) – search the directory structure on disk for entry Fi , and move the content of entry to memory
    • Close (Fi) – move the content of entry Fi in memory to directory structure on disk

Open Files

  • (^) Several pieces of data are needed to manage open files: - (^) File pointer: pointer to last read/write location, per process that has the file open - (^) File-open count: counter of number of times a file is open – to allow removal of data from open-file table when last processes closes it - (^) Disk location of the file: cache of data access information - (^) Access rights : per-process access mode information

File Types

Name,

Extension

Access Methods

  • (^) Sequential Access read next write next reset no read after last write (rewrite)
  • (^) Direct Access read n write n position to n read next write next rewrite n n = relative block number

Simulation of Sequential Access on a

Direct-access File

Example of Index and Relative

Files

A Typical File-system

Organization

Operations Performed on

Directory

  • (^) Search for a file
  • (^) Create a file
  • (^) Delete a file
  • (^) List a directory
  • (^) Rename a file
  • (^) Traverse the file system

Single-Level Directory

  • (^) A single directory for all users Naming problem Grouping problem

Two-Level Directory

  • (^) Separate directory for each user  (^) Path name  (^) Can have the same file name for different user  (^) Efficient searching  (^) No grouping capability