Вы находитесь на странице: 1из 21

Chapter 3:File Management

Learning Outcome
3.1 Explain file Management in OS
3.1.1 Identify the basic function of file system
3.1.2 Describe the file organization technique
File
Management
uses to organize
and keep track of
files

provide the
way to create
and access
the files.

How the memory is
allocated to files and
how the addresses are
saved regarding to
each file
address
translation
and
calculation for
files
File Organization technique

Entries in a sequential file are
arranged in the way they were
entered
One whose records are
arranged in an order
place records in a block one
after another until there is no
room for another complete
record in the block.
accessed one record at a time,
from first to last, in order. Each
record can be of varying length.
To reach a particular record, all
the preceding records must be
read.
Example device: Magnetic
Tapes

Figure: Records are arranged in an order

File Organization technique
contains records ordered by a
record key
The single-level indexing
structure is the simplest one
where a file, whose records
are pairs, contains a key
pointer.
This pointer is the position in
the data file of the record with
the given key.
A subset of the records,
which are evenly spaced
along the data file, is indexed,
in order to mark intervals of
data records.
Example device : Disk
storage

File Organization technique




Disk partitioning is the act
of dividing a hard disk drive
into multiple logical storage
units referred to as partitions,
to treat one physical disk
drive as if it were multiple
disks.
Partitions are also termed
"slices" for operating
systems based on BSD,
Solaris or GNU Hurd.
A partition editor software
program can be used to
create, resize, delete, and
manipulate these partitions
on the hard disk.
Example: Disk

direct or hashed access a
portion of disk space is reserved
and a hashing algorithm
computes the record address.
So there is additional space
required for this kind of file in the
store.
Records are placed randomly
through out the file.
Records are accessed by
addresses that specify their
disc location.
without going through a lot of
records to get to the one(s) you
are after.
Also, this type of file organization
requires a disk storage rather
than tape.
Example: Disk


File Structure
(a) Unstructured (Byte
sequence)
Read or write a number of bytes
User program decides meaning



(b) Structured (Record
sequence)
Fixed length
Read or write a one of record at a time
r/w in records, relates to sector sizes
Ex: Punch cards, 80 char records





(c) Complex Structured (Tree)
Record with keys
Read, insert, delete a specific record
Still used on mainframe computers
in some commercial data
processing.
Data stored in variable length
records; OS specific meaning of
each file



File Allocation
Contiguous allocation
All bytes together, in order
Random access
Must know file size
Fragmentation
Pros:
Simple: state required per file is start block and
size
Performance: entire file can be read with one
seek
Fastest if no changes are to be made also
easiest for random access file.
Cons:
Fragmentation: external is bigger problem
Usability: user needs to know size of file
It is often difficult to find free space for a new
file
External fragmentation problem
Poor performances as files grow and shrink
over time.
Used in CDROMs, DVDs

Link list non-contiguous (using blocks)
Each block points to the next block
Index with address to first
First word points to next block
Can grow files dynamically
Random Access is slow
Internal Fragmentation
Incomplete block sizes
Unreliable: what if you lose one
block in chain?
Pros: simple=need only starting address,
No waste of space, no external fragmentation
Cons :size declaration problem.










Link list non-contiguous (using
Indexed )
An index block contains pointer
to many other blocks
Associate each file with data
structure: i-node
table of files blocks

Only need i-nodes in memory
for open files
set max # of open files
Pros: no external fragmentation
problem, solve the size declaration
problem
Cons: cannot support efficient
direct access because the pointer to
block are scattered anywhere.



Free space management
Using Free list
Free space management
Using Bit map
File Access Control
Files are often used to store sensitive data such as:
Credit card numbers
Passwords
Social security numbers
Therefore, they should include mechanisms to
control user access to data.
Access control matrix
Access control by user classes

File Access Control
Access Control Matrix
List all process and files in a
matrix
Each row is a process (subject)
Each column is a file (object)
Each matrix entry is the access
rights that subject has for that
object
In an installation with a large
number of users and a large
number of files, this matrix
generally would be large and
sparse
Inappropriate for most systems

File Access Control
A technique that requires considerably less space is
to control access to various user classes
User classes can include:
The file owner
A specified user
Group
Project
Public
Access control data
Can be stored as part of the file control block
Often consumes an insignificant amount of space

Prevent Data Loss
Physical backup
backups of the
physical files used in
storing and
recovering your
database, such as
data files, control
files, and archived
redo logs
is a copy of files
storing database
information to some
other location,
whether on disk or
some offline storage
such as tape.
Prevent Data Loss
Logical backup
contain logical data (for
example, tables or stored
procedures) exported from a
database with an Oracle export
utility and stored in a binary
file, for later re-importing into a
database using the
corresponding Oracle import
utility.
Physical backups are the foundation of
any sound backup and recovery strategy.
Logical backups are a useful supplement
to physical backups in many
circumstances but are not sufficient
protection against data loss without
physical backups.
END

Вам также может понравиться