unit6
unit6
Table of Contents
6.1 File .................................................................................................................................... 3
Attributes of the File ................................................................................................................ 3
Operations on the File ............................................................................................................ 3
File Type ................................................................................................................................. 4
Directory files ...................................................................................................................... 4
Special files ......................................................................................................................... 5
6.2 Access Methods ............................................................................................................... 6
File Access Mechanisms ........................................................................................................ 6
Sequential access................................................................................................................... 7
Direct/Random access............................................................................................................ 7
Indexed sequential access ..................................................................................................... 8
SWAPPING ............................................................................................................................ 8
FILE Allocation METHODS ..................................................................................................... 9
Contiguous Allocation ............................................................................................................. 9
Linked Allocation................................................................................................................... 10
Indexed Allocation ................................................................................................................ 10
6.3 Directory Structure .......................................................................................................... 11
Single Level Directory ........................................................................................................... 11
Every file carries a name by which the file is recognized in the file system. One directory cannot
have two files with the same name.
2. Identifier
Along with the name, Each File has its own extension which identifies the type of the file. For
example, a text file has the extension .txt, A video file can have the extension .mp4.
3. Type
In a File System, the Files are classified in different types such as video files, audio files, text
files, executable files, etc.
4. Location
In the File System, there are several locations on which, the files can be stored. Each file carries
its location as its attribute.
5. Size
The Size of the File is one of its most important attribute. By size of the file, we mean the number
of bytes acquired by the file in the memory.
6. Protection
The Admin of the computer may want the different protections for the different files. Therefore
each file carries its own set of permissions to the different group of Users.
7. Time and Date
Every file carries a time stamp which contains the time and date on which the file is last
modified.
Creation of the file is the most important operation on the file. Different types of files are created
by different methods for example text editors are used to create a text file, word processors are
used to create a word file and Image editors are used to create the image files.
2. Write
Writing the file is different from creating the file. The OS maintains a write pointer for every file
which points to the position in the file from which, the data needs to be written.
3. Read
Every file is opened in three different modes : Read, Write and append. A Read pointer is
maintained by the OS, pointing to the position up to which, the data has been read.
4. Re-position
Re-positioning is simply moving the file pointers forward or backward depending upon the user's
requirement. It is also called as seeking.
5. Delete
Deleting the file will not only delete all the data stored inside the file, It also deletes all the
attributes of the file. The space which is allocated to the file will now become available and can
be allocated to the other files.
6. Truncate
Truncating is simply deleting the file except deleting attributes. The file is not completely deleted
although the information stored inside the file get replaced.
File Type
File type refers to the ability of the operating system to distinguish different types of file such as
text files source files and binary files etc. Many operating systems support many types of files.
Operating system like MS-DOS and UNIX have the following types of files −
Ordinary files
These are the files that contain user information.
These may have text, databases or executable program.
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 of file names and other information related to these files.
Directory 1
Directory2 Directory3
Sub
File1 File2
Directory
File3
File4
File Structure
SEQUENTIAL FILE
• Optimal for batch applications if they involve the processing of all the records
• Easily stored on tape and disk
• Poor performance for interactive applications
• considerable processing and delay due to the sequential search of the file for a
key match
Direct/Random access
Random access file organization provides,
accessing the records directly.
Each record has its own address on the file
with by the help of which 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 adjacent
locations on the storage medium.
SWAPPING
Contiguous Allocation
Each file occupies a contiguous
address space on disk.
Assigned disk address is in linear
order.
Easy to implement.
External fragmentation is a major
issue with this type of allocation
technique.
Indexed Allocation
Provides solutions to problems
of contiguous and linked
allocation.
A index block is created having
all pointers to files.
Each file has its own index block
which stores the addresses of
disk space occupied by the file.
Directory contains the
addresses of index blocks of
files.
There is one master directory which contains separate directories dedicated to each user.
For each user, there is a different directory present at the second level, containing group of
user's file.
The system doesn't let a user to enter in the other user's directory without permission.
• Byte Level
Striping along with
parity is used at
this level.
• It uses an extra
disks for storing all
the parity
information.
• If any drive gets
failed, the parity
restores the failed
disk.
If parity drive fails
fault tolerance is
not possible
CONCLUSION:
• Redundant Array of Independent Disks
• RAID 0- Data Striping
• RAID 1- Mirroring
• RAID 2- Bit Level Data Striping + Parity
• RAID 3- Byte Level Data Striping + Parity
• RAID 4- Block Level Data Striping + Parity
• RAID 5- Block Level Distributed Parity Bit
• RAID 6- Block Level Double Distributed Parity Bit