Lesson 1 Introduction To File Management
Lesson 1 Introduction To File Management
Operating Systems:
Internals and Design Principles
If there is one singular characteristic that makes squirrels
unique among small mammals it is their natural instinct
to hoard food. Squirrels have developed sophisticated
capabilities in their hoarding. Different types of food are
stored in different ways to maintain quality. Mushrooms,
for instance, are usually dried before storing. This is done
by impaling them on branches or leaving them in the
forks of trees for later retrieval. Pine cones, on the other
hand, are often harvested while green and cached in
damp conditions that keep seeds from ripening. Gray
squirrels usually strip outer husks from walnuts before
SQUIRRELS: A WILDLIFE HANDBOOK,
storing.
Kim Long
Files
File Systems
Create
Delete
Open
Close
Read
Write
File Structure
File Structure
Structure Terms
File
Field
Database
collection of related
data
relationships among
elements of data are
explicit
collection of similar
records
may be referenced by
name
access control
Record
restrictions
usually apply
collection
of related
at the file
level fields
that can be treated as a
unit by some application
program
File Management
System Objectives
Optimize performance
Minimal User
Requirements
Each user:
File System
Architecture
These file formats are consistent with the collectionof- records approach to files and determine how file
data is accessed
Logical I/O
Basic I/O
Device drivers
Device Drivers
Lowest level
Logical I/O
Logical I/O
This level is the interface between
the
logical commands issued by a
program and the physical details
required by the disk.
Logical units of data versus physical
blocks of data to match disk
requirements.
Access Method
Elements of File
Management
ease of update
economy of storage
simple maintenance
reliability
Grades of Performance
The Pile
Purpose is simply to
accumulate the mass
of data and save it
Record access is by
exhaustive search
The
Sequential
File
Indexed
Sequential File
Multiple levels of
indexing can be used
to provide greater
efficiency in access
Indexed File
B-Trees
B-Tree
Characteristics
B-Tree
Characteristi
cs
A B-tree is characterized
by its minimum degree d
and satisfies the following
properties:
Insertin
g Nodes
Into a
B-Tree
File
Directory
Informatio
n
Operations Performed
on a Directory
Two-Level Scheme
Figure 12.4
TreeStructured
Master
Directory
directory with
user
directories
underneath it
Each user
directory may
have
subdirectories
and files as
entries
Figure 12.7
Example of
TreeStructured
Directory
File Sharing
Access
Rights
None
Execution
Appending
Knowledge
Changing protection
Reading
Updating
Deletion
Record Blocking
for I/O to be
performed records
must be organized
as blocks
3) Variable-Length Unspanned
File Allocation
Disks are divided into physical blocks (sectors on a track)
Files are divided into logical blocks (subdivisions of the file)
Logical block size = some multiple of a physical block size
The operating system or file management system is responsible
for allocating blocks to files
Preallocation vs
Dynamic Allocation
Portion Size
Items to be considered:
1) contiguity of space increases performance, especially for
Retrieve_Next operations, and greatly for transactions
running in a transaction-oriented operating system
2) having a large number of small portions increases the size
of tables needed to manage the allocation information
3) having fixed-size portions simplifies the reallocation of
space
4) having variable-size or small fixed-size portions minimizes
waste of unused storage due to overallocation
Summarizing the
Alternatives
Table 12.3
File Allocation Methods
contiguous set
of blocks is
allocated to a
file at the time
of file creation
Preallocation
strategy using
variable-size
portions
12.9
After Compaction
Chained
Allocation
Allocation is on an
No external
fragmentation to worry
about
12.11
12.12
12.13
12.14
Free Space
Management
Indexing
Review
Volumes
Access Control
Access
Matrix
Access
Control
Lists
A matrix may be
decomposed by
columns, yielding
access control lists
Capabilit
y Lists
Decomposition by
rows yields
capability tickets
A capability
ticket specifies
authorized objects
and operations for
a user
UNIX File
Management
Inodes
File Allocation
Capacity of a FreeBSD File
with
4 Kbyte Block Size
Table 12.4
UNIX
Directories
Directories are
structuredInodes
in a
and
hierarchical tree
A directory that is
inside another
directory is
referred to as a
subdirectory
Figure 12.17
Volume Structure
A UNIX file
system
resides on a
single logical
disk or disk
partition and
is laid out
with the
following
elements:
Linux Virtual
File System
(VFS)
The Role of
VFS
Within the
Kernel
recoverability
security
journaling
NTFS Volume
and File Structure
Table 12.5
Windows NTFS Partition
and Cluster Sizes
NTFS Volume
Layout
Figure 12.21
Table 12.6
Figure 12.22
Summary
Files:
if access to the file is principally at random, then an indexed file or hashed file
may be the most appropriate