Print Friendly and PDF
File
A file is a named collection ofrelated information that is recorded on secondary storag e such as mag netic disks,
mag netic tapes and optical disks.In g eneral, a file is a sequence ofbits, bytes, lines or records whose meaning is
defined by the files creator and user.
File Structure
File structure is a structure, which is according to a required format that operating system can understand.
A file has a certain defined structure according to its type.
A text file is a sequence ofcharacters org anized into lines.
A source file is a sequence ofprocedures and functions.
An obj ect file is a sequence ofbytes org anized into blocks that are understandable by the machine.
When operating system defines different file structures, it also contains the code to support these file
structure. Unix, MS-DOS support minimum number offile structure.
File Type
File type refers to the ability ofthe operating system to disting uish different types offile such as text files source
files and binary files etc. Many operating systems support many types offiles. Operating system like MS-DOS
and UNIX have the following types offiles:
Ordinary files
These are the files that contain user information.
These may have text, databases or executable prog ram.
The user can apply various operations on such files like add, modify, delete or even remove the entire file.
Directory files
These files contain list offile names and other information related to these files.
Special files:
These files are also known as device files.
These files represent physical device like disks, terminals, printers, networks, tape drive etc.
These files are oftwo types
Character special files - data is handled character by character as in case ofterminals or printers.
Block special files - data is handled in blocks as in the case ofdisks and tapes.
File Access Mechanisms
File access mechanism refers to the manner in which the records ofa file may be accessed. There are several
ways to access files
Sequential access
Direct/Random access
Indexed sequential access
Sequential access
A sequential access is that in which the records are accessed in some sequence i.e the information in the file is
processed in order, one record after the other. This access method is the most primitive one. Example:
Compilers usually access files in this fashion.
Direct/Random access
Random access file org anization provides, accessing the records directly.
Each record has its own address on the file with by the help ofwhich it can be directly accessed for
reading or writing .
The records need not be in any sequence within the file and they need not be in adj acent locations on the
storag e medium.
Indexed sequential access
This mechanism is built up on base ofsequential access.
An index is created for each file which contains pointers to various blocks.
Index is searched sequentially and its pointer is used to access the file directly.
Space Allocation
Files are allocated disk spaces by operating system. Operating systems deploy following three main ways to
allocate disk space to files.
Contig uous Allocation
Linked Allocation
Indexed Allocation
Contig uous Allocation
Each file occupy a contig uous address space on disk.
Assig ned disk address is in linear order.
Easy to implement.
External frag mentation is a maj or issue with this type ofallocation technique.
Linked Allocation
Each file carries a list oflinks to disk blocks.
Directory contains link / pointer to first block ofa file.
No external frag mentation
Effectively used in sequential access file.
Inefficient in case ofdirect access file.
Indexed Allocation
Provides solutions to problems ofcontig ous and linked allocation.
A index block is created having all pointers to files.
Each file has its own index block which stores the addresses ofdisk space occupied by the file.
Directory contains the addresses ofindex blocks offiles.
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: