Docsity

File Systems: Interface and Implementation, Slides of Operating Systems

Partial preview of the text

Download File Systems: Interface and Implementation and more Slides Operating Systems in PDF only on Docsity!

Lecture 18

Ch. 10: File-System Interface

Ch 11: File System Implementation

Chapter 10: 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 F (^) i , and move the content of entry to memory
  • Close (Fi )
    • move the content of entry F (^) i 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

Directory Structure

• A collection of nodes containing

information about all files

F 1 F 2^ F 3 F 4 F n

Directory

Files

Both the directory structure and the files reside on disk Backups of these two structures are kept on tapes

Disk Structure

• Disk can be subdivided into partitions

• Partitions also known as minidisks, slices

• Disks or partitions can be RAID protected

against failure

– Redundant Array of Independent Disks

• Disk or partition can be used

– raw: without a file system

– formatted: with a file system

• Entity containing file system known as a

volume

Operations Performed on Directory

• Search for a file

• Create a file

• Delete a file

• List a directory

• Rename a file Docsity.com

Organize the Directory (Logically) to Obtain

  • Efficiency
    • locating a file quickly
  • Naming
    • convenient to users
      • Two users can have same name for different files
      • The same file can have several different names
  • Grouping
    • logical grouping of files by properties,

Two-Level Directory

• Separate directory for each user

 Path name

 Can have the same file name for different user

 Efficient searching

 No grouping capability

Tree-Structured Directories

 Efficient searching  Grouping Capability  Current directory (working directory)  cd /spell/mail/prog  type list