Transcript Chapter 12

Chapter 12
File Management Systems
Chapter goals



Describe the components and functions
of a file management system
Compare the logical and physical
organization of files and directories
Explain how secondary storage
locations are allocated to files and
describe the data structures used to
record those allocations
Chapter goals cont.



Describe file manipulation operations,
including open, close, read, delete, and
undelete operations
List access controls that can be applied
to files and directories
Describe security, backup, recovery,
and fault tolerance methods and
procedures
File Management Systems

FMS is implemented in layers like the
OS




Command layer or application program
File control
Storage I/O control
Storage devices
File Man. Systems Layers
FMS Layers


Storage devices – corresponds with
hardware layer of OS
Interacts with the bus and with
operating system device drivers to
transfer data between storage devices
and memory
FMS layers



Storage I/O control – accesses storage
locations and manages data movement
between storage devices and memory
Part of OS kernel
Its software modules include



Device drivers for each storage device or device
controller
Interrupt handlers
Buffers and cache managers
FMS layers cont.




File Control – provides a set of service functions for
manipulating files and directories
Processes service calls from users and applications
Maintains directory and storage allocation data
structures used to locate files and their associated
physical locations
Command layer or application program – users
perform common file management functions such as
copying, moving and renaming
Logical vs. physical view


Logical Storage Views – viewed by
users are a collection of files organized
within directories and storage volumes
Physical Storage Views – a collection of
physical storage locations organized as
a linear address space
Logical vs. physical view
Logical vs. physical view of a
file




File is subdivided into records
Record usually contains information
about a single customer, thing such as a
product in inventory, or an event
Records are divided into fields
Fields are individual units of data
Logical vs. physical


Logical file structure is independent of
its physical implementation
Logical file structure “ignores”



Physical storage allocations – records can
be stored in separate file locations
Data access methods
Data encoding methods
Logical structure of data file
File content and type




A file is a collection of data created by an
applications
The format of that information is called the
file type
A file can store many different data types
including text, numbers, complex data
structures, and executable instructions
Modern file management systems provide a
framework to support additional file types
File type


File type normally is declared when a
file is created
In the UNIX file management system,
the file type is stored within the
directory. In the Windows file
management system, the file type is
declared through the extension
Registered Windows File Types



In windows the extension of a file can be
associated (connected) to a specific
application
When you open a file associated with an
application, that application is started and the
file is opened in the associated application
Show associated file types – control panel,
folder options
Directory content and
structure


Files are organized into directories
Some directories are created and
maintained by software



Windows directories
Directories associated with applications
User can also create and maintain
directories
Directory content


Directories in windows are organized in a
hierarchy
Directory information includes:








Name
File type
Location
Size
Ownership
Access controls
Time stamp(s)
Show directory information for C drive
Directory Content and
Structure

Typical file ownership permissions are:





Create
Read
Update
delete
Time stamps include:




When
When
When
When
the
the
the
the
file
file
file
file
was created
most recently was read
most recently was written
last was backed up
Hierarchical Directory
Structure




Windows directory structure is
hierarchical
Directories can contain other directories
(called sub-directories)
Directories can not have more than one
parent
Sometimes called a tree structure (draw
picture)
Hierarchical directory
structures
Storage allocation




Users and applications programs
continually create and change files
When files are created they must be
given space in storage
When files grow they must be given
additional space
When files shrink unneeded space must
be released
Allocation units




Allocation unit is smallest unit of space
that can be allocated to a file
Allocation units cannot be smaller than
system data transfer unit
Data transfer unit is called a block
Block sizes range from 512 bytes to 4
KB in multiples of 512 bytes
Allocation units cont.


Is a multiple of block size, i.e. equal to
4 blocks, 8 blocks, etc.
Size of allocation unit is optimized to
use space efficiently
Storage allocation tables




FMS maintains a table of storage
allocation units
Records which units belong to which file
Records which units are available (free)
In windows this table called File
Allocation Table or FAT
Sample allocations of files



The next three slides show 3 files, how
their storage is allocated, and how FMS
records location of allocation units
Storage units are said to be “chained
together” using pointer
Each unit contains reference (pointer)
to next unit in the list
Directory listing of 3 files
Where 3 files are stored
How FMS finds files
Blocking and buffering


A logical record is a collection of data
items, or fields, that is accessed by an
application program as a single unit
A physical record is the unit of storage
transferred between the device
controller and memory in a single
operation
Blocking and buffering




Most of the time the logical size of a record
does not equal the physical allocation unit
When several logical records are grouped
within physical records that is called
blocking
Individual logical records grouped together
into one unit called a block
Blocking and buffering cont.



Simplifies data transfer between drive
and memory
Then OS must extract individual records
from the allocation unit block
If a physical record contains just one
logical record, then the file is said to be
unblocked
Blocking records
Buffer


Buffer is storage area in memory where
blocks of records from drive are copies
Buffer is used to extract individual
records from a block
Using buffers
Operations on files


There are setup requirements that need
to be executed whenever a file is first
requested by an application and when
that file is not longer needed
These operations are called


File open
File close
File open

When an application requests a file, the
FMS must do the follow:




The file must be located on the storage
device
Ensure that application has right to access
this file
Allocates one or more buffers
Updates internal table of open files
File close

When application sends request to close
a file, FMS does the following:




Flushing the program’s I/O buffers to
secondary storage
De-allocate buffer memory
Update directory entry time stamp
Update file open table
Delete and Undelete
Operations




In most file management systems, files are
not removed immediately from secondary
storage when they are deleted
The file’s storage allocation units are marked
as free and its directory entry is marked as
unused
A user might be able to use the undelete
operation to recover the file
Recyling bin in windows allows files to be
undeleted
Access controls



A File Management System helps
prevent loss, corruption and
unauthorized access to files
The operating system is used to identify
and authenticate users and their
processes
The file access is authenticated through
id’s and passwords
Access control

For Example:





UNIX defines three access control types:
Read
Write
Execute
Internet web sites – you can read pages
but not change them (unless you are a
hacker)
FMS Backup options



Full Backup – the FMS copies all files
and directories for an entire storage
volume
Incremental Backup – only the files that
have been modified are archived
Differential Backup – only the changed
portions of the files are archived
Windows backup

Programs accessories system tools
Summary



The file management system (FMS), usually
a part of the operating system, manages all
aspects of user and program access to
secondary storage
With directories, users can organize the
thousands of files stored in a typical computer
system
Secondary storage units are divided into
allocation units, which are typically a few
kilobytes in size
Summary cont.



The FMS allocates buffers to support
program file I/O
The FMS enforces access controls when
accessing files on behalf of a user or program
FMSs provide utilities to make backup copies
of files and directories and to recover them if
needed