File%20Systems - PowerPoint PPT Presentation

About This Presentation
Title:

File%20Systems

Description:

Directories: system files to maintain system's structure ... User (or process) specifies a directory as current and all paths (not beginning ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 20
Provided by: steve1823
Category:

less

Transcript and Presenter's Notes

Title: File%20Systems


1
File Systems
  • Chapter 6

6.1 Files 6.2 Directories 6.3 File system
implementation 6.4 Example file systems
2
Long-term Information Storage
  • Must store large amounts of data (virtual address
    space may not be big enough)
  • Information stored must survive the termina-tion
    of the process using it, or if the computer
    crashes
  • Multiple processes must be able to access the
    information concurrently
  • Files are managed by the OS. Structure,
    management, naming, accessing, etc, are part of
    the file system.

3
File Naming
  • Characters, digits, special characters
  • Lower case and upper case letters
  • File extensions (e.g. prog.c, prog.c.Z)
  • Unix extensions mean nothing, however certain
    programs may require specific extensions
  • Windows aware of extensions assigns meaning.
    Programs own extensions.

4
File Naming
  • Typical file extensions.

5
File Structure
  • Three kinds of files
  • byte sequence no meaning for OS, meaning at
    user level
  • record sequence fixed length, structure (e.g.
    card images)
  • tree each has a key field, tree is sorted on
    that key

6
File Types
  • Regular files the ones that contain user
    information
  • Directories system files to maintain systems
    structure
  • Unix Character and Block special files
  • Regular files
  • ASCII (plain text)
  • binary (internal structure)
  • Every OS must at least recognize its own
    executable file

7
File Types
  • (a) An executable file (b) An archive

8
File Access
  • Sequential access
  • read all bytes/records from the beginning
  • cannot jump around, could rewind or back up
  • convenient when medium was magnetic tape
  • Random access
  • bytes/records read in any order
  • essential for data base systems
  • read can be done in 2 ways
  • give the position in the file and initiate a read
  • move file marker (seek) to set current position
    and then read

9
File Attributes
  • Possible file attributes

10
File Operations
  1. Create
  2. Delete
  3. Open
  4. Close
  5. Read
  6. Write
  1. Append
  2. Seek
  3. Get attributes
  4. Set Attributes
  5. Rename

11
An Example Program Using File System Calls (1/2)
12
An Example Program Using File System Calls (2/2)
13
Memory-Mapped Files
  • Motivation access files in a uniform way
  • Segmented process before mapping files into its
    address space
  • Process after mapping
  • existing file abc into one segment
  • creating new segment for xyz
  • Problems the usual ones

14
DirectoriesSingle-Level Directory Systems
  • A single level directory system
  • contains 4 files
  • owned by 3 different people, A, B, and C
  • Potential problem same filenames

15
Two-level Directory Systems
  • Each user gets a private directory letters
    indicate owners of the directories and files
  • When a user tries to open a file, system knows
    which user is
  • Users may want to access files in other users
    directories

16
Hierarchical Directory Systems
  • A hierarchical directory system

17
Path Names
  • If file system is a directory tree gt naming
    scheme?
  • Two methods to specify file names
  • absolute paths path from root to file (e.g.
    /usr/ast/mailbox)
  • relative paths used in conjunction with the
    working or current directory. User (or process)
    specifies a directory as current and all paths
    (not beginning with the separator) are taken
    relative to that (e.g. ast/mailbox, if current
    /usr/)
  • Each process has its own working directory
  • Library procedures rarely change the working
    directory
  • . (dot) and .. (dotdot) directories current and
    parent directories

18
Path Names
  • A UNIX directory tree

19
Directory Operations
  • Readdir
  • Rename
  • Link
  • Unlink
  1. Create
  2. Delete
  3. Opendir
  4. Closedir
Write a Comment
User Comments (0)
About PowerShow.com