BlueAdmiral.com |
File Management |
What is a file? A file can be described as a container that stores data that is accessible by a computer system - it is basically a container holding a set of related information that will be stored on some form of secondary storage. It is the file manager's responsibility to look after these containers. A data file may consist of for example, a set of computer program instructions, text or another form of data. A text file may contain just a short letter, or contain a complete book. In other words a file is basically a defined set of named data. Why is file management needed? The operating system will have to maintain a secure and well managed file system for all the users of the computer system. Mechanisms will have to exist to ensure correct and authorized use of any of the files under the file manager's care. It could be said that this part of the operating system is the most visible to the user, as the user will have specific file requirements and will expect requirement results to be evidenced. The file manager will aim to ensure data integrity and will ensure that files are kept secure. In order to do this the file manager will maintain accurate information about all the files, their use and their movement throughout any file management system. A file will be created, modified or deleted in some way as a direct result of some form of processing activity - which in turn is undertaken by the process manager. As such the file manager needs to ensure that all its files are fully protected from misuse or accidental damage at all times. The File Manager (FM) will have a predetermined policy that will state how a file is created, used, stored and retrieved. Ultimately the policy will be based on flexibility of access to the files and protection of the files. The FM is mainly concerned with providing a suitable interface for users to manipulate files. Users need to be able to store data long term. This obviously requires a very large and non-volatile memory area. This area needs to be organised and controlled. The FM provides this area in a controlled and structured way (and with the support of the DM). The file manager will typically create a file 'tag' which basically acts as a file descriptor. This descriptor will typically log details of the use of any file, its movement, the file's symbolic name, and its current status, (for example if a file is protected, or archived, etc.). Once a file is actually opened the file manager will append further information to the file descriptor, such as for example, where a file is physically kept in secondary storage (to allow for a file's return, etc.). Typical responsibilities of a File Manager include:
Related file definitions Before looking at the role of the file manager in greater detail, you should understand the following terms:- Bit: A binary digit - 0 or 1. Byte: 8 bits of data, grouped together to represent a single character (e.g., a letter, number or symbol) with 256 possible bit combinations. Record: A complete set of related data bytes. A set of logically related fields. File: A group of logically related records. Directory: Information about files and their
location. Volume: A physical device that stores the
files.
Data and File or Organisation The files managed by the operating system may consist of a simple set of bytes, through to a complicated stream of records. The operating system will facilitate the structuring of the data contained within a file. Typically each set of data shown on Figure 1. below is significantly more complex than the set above it. Starting with the single binary bit, which represents the 'on' or 'off state of an electrical pulse. One set of eight of these pulses represents one byte. here the sequence of the eight pulses will represent one single character, such as the ASCII character 'A'. A field represents a set of encoded bytes, showing their final characters. Its worth noting that the character <space> will also exist here as its own unique ASCII character. A record will hold together a set of related fields. Finally the file itself will contain a set number of records that may be organized in some way, for example randomly or sequentially.
User Interface The FM provides the user with a limited
set of file system commands. The commands are low-level and the
real complexities are hidden from the user. These commands may
be used in programs, or interactively by the user. They are device
independent -users do not need to know the exact location of file.
Users can create and manipulate their files using the simple set
of commands that follow:-
Volumes A volume is a physical storage unit (e.g.,
a disk), and may be fixed or removable. Each volume will have
a 'Volume Descriptor - the FM can then interact with the Volume as necessary. The FM
will ensure each volume will have unique details (given in
1st sector of 1st track) as follows:-
Creation date date volume created A Master File Directory (MFD) is created for each volume, and follows the volume identifiers - it is transparent to users. All file requests will follow path starting with MFD as point of entry. The FM will search the MFD for a pointer to the first directory (the user's directory).
Directory structure A directory is basically a set of linked files whereby they are organised in a way suited to the humans that they serve. The file manager will observe a set of rules ( a policy) in which it will look after the directory and access rights to the files contained within. Directories are organized on a volume, (HDD, FDD, Tape, etc.). This organization provides a logical and controlled access to files. The normal organization is a tree structure. This provides easy and fast access and searches. Each directory entry will contain fields to indicate: I. a symbolic name of the file 2. the size and the position of the file on the volume 3. the type of access permitted to the file
Each directory may contain a number of sub-directories. The structure of directories and the relationship between them is managed by the FM (this may differ between operating systems). Examples of directory structures include: I. single level - best used where users have equal status 2. hierarchical - more common; it can be used to represent organizational structure. Directory structure The directory contains an overview of all
the data held. Each file has a 'file descriptor' entry in the
directory structure. A typical file descriptor contains the following
information, with typical properties:-
File Names Files may be identified as follows:-
Examples of file extensions and file types
include:-
Whatever the operating system in use, a control mechanism will exist to safeguard the integrity of the files (and directories). All files will contain a number of attributes that will be monitored and maintained by the file manager. File attributes may be:
Main file operations include facilities such as:- Create The file manager will first find an available space on the specified secondary storage device. Once space has been allocated, the file manager will record the given name and location of the file for future reference. Write The file manager is responsible for agreeing the name of the file according to naming conventions, and specifying the contents to be written to the file. Retrieve The file manager will be responsible for delivering accurate file name indicators, so that file retrieval is possible. Delete The file manager will first establish that the user is authorized to take such action. On authorization the file manager will release the file space so that the space can be made available to another file.
Other operations for example include:-
Attributes (for protecting a file ) include:-
Records and record format Records are stored and organized within a file in one of the following ways:-
The record format includes the following features:
Blocked records This is a storage saving and input/output saving policy. It aims to saves group related records together in one block, and also facilitates retrieval of the same records in one block. It has the following features:-
Two techniques employed include:- Fixed length records Non-contiguous storage Linked lists Summary |