Department of Information Technology, G H Patel College of Engineering and Technology,
Academic Year – 2017-18 (Even)
2140702 – Operating Systems
File concept, Access methods, File types,
File operation, Directory structure, File
System structure, Allocation methods
(contiguous , linked, indexed)
Prepared By
Tejoy Vachhrajani (160110116057)
Khyati Valera (160110116059)
Vashi Bhavik (160110116061)
Department of Information Technology, G H Patel College of Engineering and Technology 2
File Concept
• Files are the building blocks of any operation system. Permanent
storage of information & data is a file.
• OS is not interested in what information is stored in file . OS maps
files with physical devices.
• User prepare a program (file ), File represent program and data.
The output of program is executable file.
Department of Information Technology, G H Patel College of Engineering and Technology 3
Access Methods
• File access mechanism refers to the manner in which the records
of a file may be accessed. There are several ways to access files
• Sequential access
• Direct/Random access
• Indexed sequential access
Department of Information Technology, G H Patel College of Engineering and Technology 4
Access Methods : 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.
Department of Information Technology, G H Patel College of Engineering and Technology 5
Access Methods : 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.
Department of Information Technology, G H Patel College of Engineering and Technology 6
Access Methods: Indexed sequential access
• This mechanism is built up on base of sequential 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.
Department of Information Technology, G H Patel College of Engineering and Technology 7
File types
• 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
• Directory files
• Special files
Department of Information Technology, G H Patel College of Engineering and Technology 8
File types : 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.
Department of Information Technology, G H Patel College of Engineering and Technology 9
File types : Directory files
• These files contain list of file names and other information related
to these files.
Department of Information Technology, G H Patel College of Engineering and Technology 10
File types : 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 of two types −
• Character special files − data is handled character by character as in case
of terminals or printers.
• Block special files − data is handled in blocks as in the case of disks and
tapes.
Department of Information Technology, G H Patel College of Engineering and Technology 11
File Operations
• File Create Operation : The file is created with no data.
• File Delete Operation : File must has to be deleted when it is no
longer needed just to free up the disk space.
• File Open Operation : The process must open the file before
using it.
• File Close Operation : The file must be closed to free up the
internal table space, when all the accesses are finished and the
attributes and the disk addresses are no longer needed.
• File Read Operation : The file read operation is performed just to
read the data that are stored in the required file.
Department of Information Technology, G H Patel College of Engineering and Technology 12
File Operations
• File Write Operation : The file write operation is used to write the data to the file,
again, generally at the current position.
• File Append Operation : The file append operation is same as the file write
operation except that the file append operation only add the data at the end of the
file.
• File Seek Operation : For random access files, a method is needed just to specify
from where to take the data. Therefore, the file seek operation performs this task.
• File Get Attribute Operation : The file get attributes operation are performed by
the processes when they need to read the file attributes to do their required work.
• File Set Attribute Operation : The file set attribute operation used to set some of
the attributes (user settable attributes) after the file has been created.
• File Rename Operation : The file rename operation is used to change the name of
the existing file.
Department of Information Technology, G H Patel College of Engineering and Technology 13
Directory structure
• Directory is a symbol table of files that stores all the related
information about the file it hold with the contents. Directory is a
list of files. Each entry of a directory define a file information like a
file name, type, its version number, size ,owner of file, access
rights, date of creation and date of last backup.
• Types:-
• 1. Single level directory
• 2. Two level directory
• 3. Tree structured directory
• 4. Acyclic graph directory
• 5. General graph directory
Department of Information Technology, G H Patel College of Engineering and Technology 14
Directory structure
1.Single level directory: -
• In a single level directory system, all the files are placed in one
directory
Department of Information Technology, G H Patel College of Engineering and Technology 15
Directory structure
2.Two level directory: -
• In the two-level directory system, the system maintains a master
block that has one entry for each user.
Department of Information Technology, G H Patel College of Engineering and Technology 16
Directory structure
3.Tree structured directory:-
• In the tree-structured directory, the directory themselves are files.
This leads to the possibility of having sub-directories that can
contain files and sub-subdirectories.
Department of Information Technology, G H Patel College of Engineering and Technology 17
Directory structure
4. Acyclic graph directory:-
• The acyclic directory structure is an extension of the tree-
structured directory structure.
Department of Information Technology, G H Patel College of Engineering and Technology 18
Directory structure
5. General graph directory: -
• The general graph directory is formed by adding links into an
existing tree structure. It overcomes the problem of acyclic graph
by allows the cycles in a directory.
Department of Information Technology, G H Patel College of Engineering and Technology 19
File System Structure
• File system is mounted and maintained by the secondary storage
which provides by disk.
• Characteristics of disk : same place is used for reading , writing ,
modification , user can access disk directly for any block of
information
• Concept of file system is used for the efficient and convenient
access to the disk.
• File system stricter allows to data to store , locate , retrieved data.
Department of Information Technology, G H Patel College of Engineering and Technology 20
Department of Information Technology, G H Patel College of Engineering and Technology 21
File System Structure
IO control interface:-
• It consists of device driver & interrupt hander.
• Transfer data : main memory to disk system.
Basic file system layer:-
• Generate command for device driver.
• Also manage buffer memory & cache.
File Organization Module layer:-
• Maintain information about files
Department of Information Technology, G H Patel College of Engineering and Technology 22
File System Structure
Logical file System Layer :-
• Manages the meta data information.
Application Program Layer :-
• User creates application program.
Physical hardware device layer:-
• Contain actual hardware device.
Department of Information Technology, G H Patel College of Engineering and Technology 23
File System Structure
OS File System Format
Windows FAT , FAT32 , NTFS
UNIX UNIX File System
Standard LINUX Extended File System
Department of Information Technology, G H Patel College of Engineering and Technology 24
Department of Information Technology, G H Patel College of Engineering and Technology 25
Allocation methods
• Files are allocated disk spaces by operating system. Operating
systems deploy following three main ways to allocate disk space to
files.
• Contiguous Allocation
• Linked Allocation
• Indexed Allocation
Department of Information Technology, G H Patel College of Engineering and Technology 26
Allocation methods : 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.
Department of Information Technology, G H Patel College of Engineering and Technology 27
Allocation methods : Linked Allocation
• Each file carries a list of links to disk blocks.
• Directory contains link / pointer to first block of a file.
• No external fragmentation
• Effectively used in sequential access file.
• Inefficient in case of direct access file.
Department of Information Technology, G H Patel College of Engineering and Technology 28
Allocation methods : 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.
Department of Information Technology, G H Patel College of Engineering and Technology 29

File management in OS

  • 1.
    Department of InformationTechnology, G H Patel College of Engineering and Technology, Academic Year – 2017-18 (Even) 2140702 – Operating Systems File concept, Access methods, File types, File operation, Directory structure, File System structure, Allocation methods (contiguous , linked, indexed) Prepared By Tejoy Vachhrajani (160110116057) Khyati Valera (160110116059) Vashi Bhavik (160110116061)
  • 2.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 2 File Concept • Files are the building blocks of any operation system. Permanent storage of information & data is a file. • OS is not interested in what information is stored in file . OS maps files with physical devices. • User prepare a program (file ), File represent program and data. The output of program is executable file.
  • 3.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 3 Access Methods • File access mechanism refers to the manner in which the records of a file may be accessed. There are several ways to access files • Sequential access • Direct/Random access • Indexed sequential access
  • 4.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 4 Access Methods : 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.
  • 5.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 5 Access Methods : 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.
  • 6.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 6 Access Methods: Indexed sequential access • This mechanism is built up on base of sequential 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.
  • 7.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 7 File types • 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 • Directory files • Special files
  • 8.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 8 File types : 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.
  • 9.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 9 File types : Directory files • These files contain list of file names and other information related to these files.
  • 10.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 10 File types : 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 of two types − • Character special files − data is handled character by character as in case of terminals or printers. • Block special files − data is handled in blocks as in the case of disks and tapes.
  • 11.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 11 File Operations • File Create Operation : The file is created with no data. • File Delete Operation : File must has to be deleted when it is no longer needed just to free up the disk space. • File Open Operation : The process must open the file before using it. • File Close Operation : The file must be closed to free up the internal table space, when all the accesses are finished and the attributes and the disk addresses are no longer needed. • File Read Operation : The file read operation is performed just to read the data that are stored in the required file.
  • 12.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 12 File Operations • File Write Operation : The file write operation is used to write the data to the file, again, generally at the current position. • File Append Operation : The file append operation is same as the file write operation except that the file append operation only add the data at the end of the file. • File Seek Operation : For random access files, a method is needed just to specify from where to take the data. Therefore, the file seek operation performs this task. • File Get Attribute Operation : The file get attributes operation are performed by the processes when they need to read the file attributes to do their required work. • File Set Attribute Operation : The file set attribute operation used to set some of the attributes (user settable attributes) after the file has been created. • File Rename Operation : The file rename operation is used to change the name of the existing file.
  • 13.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 13 Directory structure • Directory is a symbol table of files that stores all the related information about the file it hold with the contents. Directory is a list of files. Each entry of a directory define a file information like a file name, type, its version number, size ,owner of file, access rights, date of creation and date of last backup. • Types:- • 1. Single level directory • 2. Two level directory • 3. Tree structured directory • 4. Acyclic graph directory • 5. General graph directory
  • 14.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 14 Directory structure 1.Single level directory: - • In a single level directory system, all the files are placed in one directory
  • 15.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 15 Directory structure 2.Two level directory: - • In the two-level directory system, the system maintains a master block that has one entry for each user.
  • 16.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 16 Directory structure 3.Tree structured directory:- • In the tree-structured directory, the directory themselves are files. This leads to the possibility of having sub-directories that can contain files and sub-subdirectories.
  • 17.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 17 Directory structure 4. Acyclic graph directory:- • The acyclic directory structure is an extension of the tree- structured directory structure.
  • 18.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 18 Directory structure 5. General graph directory: - • The general graph directory is formed by adding links into an existing tree structure. It overcomes the problem of acyclic graph by allows the cycles in a directory.
  • 19.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 19 File System Structure • File system is mounted and maintained by the secondary storage which provides by disk. • Characteristics of disk : same place is used for reading , writing , modification , user can access disk directly for any block of information • Concept of file system is used for the efficient and convenient access to the disk. • File system stricter allows to data to store , locate , retrieved data.
  • 20.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 20
  • 21.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 21 File System Structure IO control interface:- • It consists of device driver & interrupt hander. • Transfer data : main memory to disk system. Basic file system layer:- • Generate command for device driver. • Also manage buffer memory & cache. File Organization Module layer:- • Maintain information about files
  • 22.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 22 File System Structure Logical file System Layer :- • Manages the meta data information. Application Program Layer :- • User creates application program. Physical hardware device layer:- • Contain actual hardware device.
  • 23.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 23 File System Structure OS File System Format Windows FAT , FAT32 , NTFS UNIX UNIX File System Standard LINUX Extended File System
  • 24.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 24
  • 25.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 25 Allocation methods • Files are allocated disk spaces by operating system. Operating systems deploy following three main ways to allocate disk space to files. • Contiguous Allocation • Linked Allocation • Indexed Allocation
  • 26.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 26 Allocation methods : 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.
  • 27.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 27 Allocation methods : Linked Allocation • Each file carries a list of links to disk blocks. • Directory contains link / pointer to first block of a file. • No external fragmentation • Effectively used in sequential access file. • Inefficient in case of direct access file.
  • 28.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 28 Allocation methods : 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.
  • 29.
    Department of InformationTechnology, G H Patel College of Engineering and Technology 29