Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Two Parts
z
Filesystem Interface
z
Filesystem design
z
Filesystem Interface
Basic Topics
z
z
z
z
z
z
File Concept
Access Methods
Directory Structure
File System Mounting
File Sharing
Protection
File Concept
z
File Types
z
Data
z
z
z
z
z
Text, binary,
Program
Regular files stores information
Directory stores information about file(s)
Device files represents different devices
File Structure
z
z
Lines
Fixed length
Variable length
Complex Structures
z
z
Formatted document
Relocatable load file
File Operations
z
z
z
z
z
z
z
Create
Write
Read
Reposition within file file seek
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
Access Methods
z
Sequential Access
read next
write next
reset
Direct Access
read n
write n
position to n
read next
write next
n = relative block number
Sequential-access File
Directory Structure
z
Directory
Files
F1
F2
F3
F4
Fn
A Typical File-system
Organization
Information in a Device
Directory
z
z
z
z
z
z
z
z
z
Name
Type
Address
Current length
Maximum length
Date last accessed (for archival)
Date last updated (for dump)
Owner ID (who pays)
Protection information (discuss later)
Operations Performed on
Directory
z
z
z
z
z
z
Single-Level Directory
z
Problems
Naming problem
z Grouping problem
z
Two-Level Directory
z
Path name
Can have the same file name for different user
Efficient searching
No grouping capability
Tree-Structured Directories
Tree-Structured Directories
(Cont.)
z
Efficient searching
Grouping Capability
cd /spell/mail/prog
type list
Tree-Structured Directories
(Cont.)
z
z
Acyclic-Graph Directories
z
Acyclic-Graph Directories
(Cont.)
z
z
z
z
z
z
sys
//
local
adm
users bin
dev
etc
bin
z
z
z
z
Ex. can now mount some other filesystem fs2 on /usr/adm, will
hide all files under /adm under fs1 and access to /usr/adm will go
to corresponding part of fs2
File Sharing
z
Protection
z
Types of access
z
z
z
z
z
z
Read
Write
Execute
Append
Delete
List
Filesystem Implementation
Basic Topics
z
z
z
z
z
z
z
z
Disk Layout
z
z
z
z
Allocation Methods
z
Contiguous allocation
Linked allocation
Indexed allocation
Contiguous Allocation
z
z
z
z
Fragmentation possible
Extent-Based Systems
z
Linked Allocation
z
z
z
Linked Allocation
File-Allocation Table
Indexed Allocation
z
index table
Two-level Indexing
z
outer-index
index table
file
i-nodes
z
z
FCB in Unix
Contains file attributes and disk address of
blocks
One block can hold only limited number of disk
block addresses, limits size of file
Solution: use some of the blocks to hold address
of blocks holding address of disk blocks of files
z
Unix i-node
z
z
z
File Attributes
12 direct pointers
1 singly indirect pointer
z
Directory Implementation
z
z
z
z
simple to program
time-consuming to execute
Hash Table linear list with hash data structure
z
z
Free-Space Management
Bit vector (n blocks)
0 1
n-1
bit[i] =
678
1 block[i] free
0 block[i] occupied
Free-Space Management
(Cont.)
z
z
z
Free-Space Management
(Cont.)
z
Need to protect:
z
z
Virtual File Systems (VFS) provide an objectoriented way of implementing file systems.
VFS allows the same system call interface (the
API) to be used for different types of file
systems.
The API is to the VFS interface, rather than any
specific type of file system.
z
z
Performance
z
Various Disk-Caching
Locations
Page Cache
z
z
z
Recovery
z