Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lecture Slides on File System Interface | CSCI 444, Study notes of Operating Systems

Material Type: Notes; Professor: Wang; Class: Operating Systems; Subject: Computer Science; University: William and Mary; Term: Fall 2008;

Typology: Study notes

2009/2010

Uploaded on 02/24/2010

koofers-user-ctn
koofers-user-ctn 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
File System Interface
CSCI 444/544 Operating Systems
Fall 2008
Agenda
File system abstraction
Directory structure
File operations
File system mounting
File System Abstraction
File system is the OS abstraction for storage resources
(especially, disk)
Track/sector <=> files
Provides a uniform logical view of information storage
File is a logical storage unit in the OS abstract interface
for storage resources
Directory is a logical “container” for a group of files
File Concept
To a user process, a file is a contiguous block of bytes
User view: named collection of bytes
OS view: collection of blocks on physical non-volatile
storage device
Types:
Data
numeric
character
binary
Program (source and o bject)
pf3
pf4
pf5

Partial preview of the text

Download Lecture Slides on File System Interface | CSCI 444 and more Study notes Operating Systems in PDF only on Docsity!

File System Interface

CSCI 444/544 Operating Systems

Fall 2008

Agenda

  • File system abstraction
  • Directory structure
  • File operations
  • File system mounting

File System Abstraction

File system is the OS abstraction for storage resources

(especially, disk)

Track/sector <=> files

  • Provides a uniform logical view of information storage
  • File is a logical storage unit in the OS abstract interface

for storage resources

  • Directory is a logical “container” for a group of files

File Concept

To a user process, a file is a contiguous block of bytes

User view: named collection of bytes

OS view: collection of blocks on physical non-volatile

storage device

Types:

  • Data
    • numeric
    • character
    • binary
  • Program (source and object)

File Structure

Sequence of words, bytes

Simple record structure

  • Lines
  • Fixed length
  • Variable length

Complex Structures

  • Formatted document

File Attributes (Meta-data)

Name – a string used to uniquely identify a file

Identifier – unique tag (number) identifies file within file

system

Type – needed for systems that support different types

Location – pointer to file location on device

Size – current file size

Protection – controls who can do reading, writing, executing

Time, date, and user identification – data for protection,

security, and usage monitoring

These meta-data (Information about files) are kept in the

directory structure, which is maintained on the disk but

cached in memory if the file is open.

File Systems

OK, we have files

How can we name them?

How can we organize them?

File Naming

Each file has an associated human-readable name

  • e.g., usr, bin, mid-term.pdf, design.pdf

OS must maintain a mapping between file names

and the set of blocks belong to that file

  • In Unix, this is a mapping between names and i-nodes

Mappings are kept in directories

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

Tree-Structured Directories (Cont)

Efficient searching

Grouping Capability

Current directory (working directory)

  • cd /spell/mail/prog
  • type list

Tree-Structured Directories (Cont)

Absolute or relative path name

Creating a new file is done in current directory

Delete a file

rm <file-name>

Creating a new subdirectory is done in current

directory

mkdir <dir-name>

Example: if in current directory /mail

mkdir count

mail

prog copy prt exp count

Deleting “mail” ⇒ deleting the entire subtree rooted by “mail”

Acyclic-Graph Directories

Have shared subdirectories and files

Acyclic-Graph Directories (Cont.)

More general than tree structure

  • Add connections across the tree (no cycles)
  • Create links from one file (or directory) to another

Two different names (aliasing)

New directory entry type

  • Link – another name (pointer) to an existing file
  • Resolve the link – follow pointer to locate the file

File Operations

Create

Write

Read

Reposition within file

Delete

Truncate

Open(F

i

) – search the directory structure on disk for

entry F

i

, and move the content of entry to memory

Close (F

i

) – move the content of entry F

i

in memory

to directory structure on disk

Open Files

Open() file before first access

  • User specifies mode: read and/or write
  • Search directories for filename and check permissions
  • Copy relevant information to open file table in memory
  • Return index in open file table to process (file descriptor)
  • Process uses file descriptor to read/write to file

Two levels of open file tables

  • Per-process open file table
    • Track all files that a process has open
    • Current file pointer indicating the current read or write position
  • System-wide open-file table
    • Contains process-independent file information
      • Location of the file on disk, file size, etc.