Lecture 37-39
Lecture 37-39
Concepts
LECTURE 37-39 – FILE MANAGEMENT
Files
Field
Basic element of data
Contains a single value
Characterized by its length and data type
Record
Collection of related fields
Treated as a unit
File
Have file names
Is a collection of similar records or collection of similar data or information
Treated as a single entity
May implement access control mechanisms
File System Software Architecture
File System Software Architecture
Contd.
Device Drivers
Lowest level
Communicates directly with peripheral devices
Responsible for starting I/O operations on a device
Processes the completion of an I/O request
Basic File System or Physical I/O
Primary interface with the environment outside the computer system
Deals with exchanging blocks of data
Concerned with the placement of blocks
Concerned with buffering blocks in main memory
File System Software Architecture
Contd.
Access Methods
Closest to the user
Reflect different file structures
Provides a standard interface between applications and the file systems and
devices that hold the data
Access method varies depending on the file structure
File Organization
In this type of file a fixed format is used for records. All records are of fixed or same length
consisting of same number of fields of fixed length.
One particular field usually the first field in each record is referred to as the Key field. It
uniquely identifies the record. The Key values for different records are always different.
The records are stored in key sequence, alphabetical order for a text key and numerical order
for numerical key.
Sequential files are typically used in batch applications, involving the processing of all the
records (a billing or payroll application).
For interactive applications that involve queries or update of individual records the sequential
file provides poor performance.
A sequential file is stored in single sequential ordering of records with in blocks.
The physical organization of the file on tape or disk directly matches the logical organization, in
the case the usual procedure is to place new records in a separate “Pile” file, called a log file or
transaction file.
Periodically a batch update is performed that merges the log file with the master file to produce
a new file in correct sequence.
Indexed Sequential File
The index in this case is a simple sequential file. Each record in the index file
consists of two fields, a key field, which is same as the key field in the main file,
and a pointer, into main file, to find a specific field, the index is searched to find
key value that is equal to the desired key value.
The search continues in the main file at the location indicated by the pointer.
Each record in the main file contains an additional field not visible to the
application, which is a pointer to the overflow file. When a new record is to be
inserted into the file it is added to the overflow file.
The index sequential file greatly reduces the time required to access a single
record without sacrificing the sequential nature of the file.
Indexed File
Basic Information
Address Information
Access Control Information
Usage Information
Directory Elements:
Basic Information
File Name
Name as chosen by creator be unique with in a directory
File Type
Text file, Binary file
File Organization
For systems that support different file organizations.
Directory Elements:
Address Information
Volume
Indicate device on which file is stored.
Starting Address
Starting physical address on secondary storage for example cylinder track
and block number on disk.
Size Used
Current size of the file in bytes, words or blocks.
Size Allocated
The maximum size of the file.
Directory Elements:
Access Control Information
Owner
The owner may be able to grant/deny access to other users and to change
these privileges.
Access Information
May include the user’s name and password for each authorized user.
Permitted Actions
Controls reading, writing, executing, transmitting over a network
Directory Elements:
Usage Information
Date Created
Identity of Creator
Date Last Read Access
Identity of Last Reader
Date Last Modified
Identity of Last Modifier
Date of Last Backup
Current Usage
Current activity, locks, etc
Structure for a Directory
Execution
The user can load and execute a program but cannot copy it
Reading
The user can read the file for any purpose, including copying and execution
Appending
The user can add data to the file but cannot modify or delete any of the file’s
contents
Access Rights cont…
Updating
The user can modify, delete, and add to the file’s data.
Changing protection
User can change access rights granted to other users
Deletion
User can delete the file
User Classes
Owner
Usually the files creator, usually has full rights
Specific Users
Rights may be explicitly granted to specific users
User Groups
A set of users identified as a group
All
everyone
Simultaneous Access