File system Interface:The concept of a file, access methods, directory structure, file system
mounting, files sharing, protection.
File System Implementation: File system structure, allocation methods, free-space
management, and secondary storage structure – overview of mass-storage structure, disk
scheduling and algorithms
File
A file is a named collection of related information that is recorded on secondary storage such as
magnetic disks, magnetic tapes and optical disks. In general, a file is a sequence of bits, bytes,
lines or records whose meaning is defined by the files creator and user.
Properties of a File System
Here, are important properties of a file system:
• Files are stored on disk or other storage and do not disappear when a user logs off.
• Files have names and are associated with access permission that permits controlled
sharing.
• Files could be arranged or more complex structures to reflect the relationship between
them.
File Attributes
A file has a name and data. Moreover, it also stores meta information like file creation date and
time, current size, last modified date, etc. All this information is called the attributes of a file
system.
Here, are some important File attributes used in OS:
• Name: It is the only information stored in a human-readable form.
• Identifier: Every file is identified by a unique tag number within a file system known as
an identifier.
• Location: Points to file location on device.
• Type: This attribute is required for systems that support various types of files.
• Size. Attribute used to display the current file size.
• Protection. This attribute assigns and controls the access rights of reading, writing, and
executing the file.
• Time, date and security: It is used for protection, security, and also used for monitoring
Functions of File
• Create file, find space on disk, and make an entry in the directory.
• Write to file, requires positioning within the file
• Read from file involves positioning within the file
, • Delete directory entry, regain disk space.
• Reposition: move read/write position.
File types- name, extension
File Type Usual extension Function
Executable exe, com, bin or ready-to-run machine- language
none program
Object obj, o complied, machine language, not linked
Source code c. p, pas, 177, source code in various languages
asm, a
Batch bat, sh Series of commands to be executed
Text txt, doc textual data documents
Word doc,docs, tex, various word-processor formats
processor rrf, etc.
Library lib, h libraries of routines
Archive arc, zip, tar related files grouped into one file,
sometimes compressed.
File Access Methods
File access is a process that determines the way that files are accessed and read into memory.
Generally, a single access method is always supported by operating systems. Though there are
some operating system which also supports multiple access methods.
Three file access methods are:
• Sequential access
• Direct random access
, • Index sequential access
Sequential Access
In this type of file access method, records are accessed in a certain pre-defined sequence. In the
sequential access method, information stored in the file is also processed one by one. Most
compilers access files using this access method.
Random Access
The random access method is also called direct random access. This method allow accessing the
record directly. Each record has its own address on which can be directly accessed for reading
and writing.
Index sequential access
This type of accessing method is based on simple sequential access. In this access method, an
index is built for every file, with a direct pointer to different memory blocks. In this method, the
Index is searched sequentially, and its pointer can access the file directly. Multiple levels of
indexing can be used to offer greater efficiency in access. It also reduces the time needed to
access a single record.
Overview of Directory Structure
A File system contains thousands and millions of files, owned by several users. The directory
structure organizes these files by keeping entries of all the related files. The file entries have
information like file name, type, location, the mode in which the file can be accessed by other
users in the system.
The two important features that must be taken care while maintaining a directory are given
below.
1. A user must have freedom of giving the desired name to the file, without taking into
consideration that the same file names are used by other users on the system.
2. A user must be able to share the files he creates and he must also be able to access the files,
created by other users.
Directory structure provides both the above-discussed features. A directory always has
information about the group of related files. Whenever a user or a process request for a file, the
file system search for the file’s entry in the directory and when the match is found, it obtains the
file’s location from there.
, Let us now study the directory structure with the help of the figure above. The field File
name, contains the name of the concerned file in the directory, Type field indicates the kind or
category of the file, Location Info field indicates the location where the file is stored.
Protection Info field contains the information whether the file can be accessed by the other user
in the system or not. Flag field contains the kind of directory entry like value D in Flag field
indicates that the file is a directory, value L indicates that the file is a link, value M indicates that
the file is a mounted file system.
The Misc info filed in the directory contains the miscellaneous information about the owner of
the file, the time of its creation, the time at which the file was modified last.
Types of Directory Structures
In this section, we will be discussing the most common types of directories, their benefits and
drawbacks.
1. Single-level directory structure
Single level directory structure has only one directory which is called the root directory. The
users are not allowed to create subdirectories under the root directory. All the files created by the
several users are present in the root directory only.
As you can see in the diagram below all the file F1, F2, F3, F4 created by the different users are
present at the root directory.
mounting, files sharing, protection.
File System Implementation: File system structure, allocation methods, free-space
management, and secondary storage structure – overview of mass-storage structure, disk
scheduling and algorithms
File
A file is a named collection of related information that is recorded on secondary storage such as
magnetic disks, magnetic tapes and optical disks. In general, a file is a sequence of bits, bytes,
lines or records whose meaning is defined by the files creator and user.
Properties of a File System
Here, are important properties of a file system:
• Files are stored on disk or other storage and do not disappear when a user logs off.
• Files have names and are associated with access permission that permits controlled
sharing.
• Files could be arranged or more complex structures to reflect the relationship between
them.
File Attributes
A file has a name and data. Moreover, it also stores meta information like file creation date and
time, current size, last modified date, etc. All this information is called the attributes of a file
system.
Here, are some important File attributes used in OS:
• Name: It is the only information stored in a human-readable form.
• Identifier: Every file is identified by a unique tag number within a file system known as
an identifier.
• Location: Points to file location on device.
• Type: This attribute is required for systems that support various types of files.
• Size. Attribute used to display the current file size.
• Protection. This attribute assigns and controls the access rights of reading, writing, and
executing the file.
• Time, date and security: It is used for protection, security, and also used for monitoring
Functions of File
• Create file, find space on disk, and make an entry in the directory.
• Write to file, requires positioning within the file
• Read from file involves positioning within the file
, • Delete directory entry, regain disk space.
• Reposition: move read/write position.
File types- name, extension
File Type Usual extension Function
Executable exe, com, bin or ready-to-run machine- language
none program
Object obj, o complied, machine language, not linked
Source code c. p, pas, 177, source code in various languages
asm, a
Batch bat, sh Series of commands to be executed
Text txt, doc textual data documents
Word doc,docs, tex, various word-processor formats
processor rrf, etc.
Library lib, h libraries of routines
Archive arc, zip, tar related files grouped into one file,
sometimes compressed.
File Access Methods
File access is a process that determines the way that files are accessed and read into memory.
Generally, a single access method is always supported by operating systems. Though there are
some operating system which also supports multiple access methods.
Three file access methods are:
• Sequential access
• Direct random access
, • Index sequential access
Sequential Access
In this type of file access method, records are accessed in a certain pre-defined sequence. In the
sequential access method, information stored in the file is also processed one by one. Most
compilers access files using this access method.
Random Access
The random access method is also called direct random access. This method allow accessing the
record directly. Each record has its own address on which can be directly accessed for reading
and writing.
Index sequential access
This type of accessing method is based on simple sequential access. In this access method, an
index is built for every file, with a direct pointer to different memory blocks. In this method, the
Index is searched sequentially, and its pointer can access the file directly. Multiple levels of
indexing can be used to offer greater efficiency in access. It also reduces the time needed to
access a single record.
Overview of Directory Structure
A File system contains thousands and millions of files, owned by several users. The directory
structure organizes these files by keeping entries of all the related files. The file entries have
information like file name, type, location, the mode in which the file can be accessed by other
users in the system.
The two important features that must be taken care while maintaining a directory are given
below.
1. A user must have freedom of giving the desired name to the file, without taking into
consideration that the same file names are used by other users on the system.
2. A user must be able to share the files he creates and he must also be able to access the files,
created by other users.
Directory structure provides both the above-discussed features. A directory always has
information about the group of related files. Whenever a user or a process request for a file, the
file system search for the file’s entry in the directory and when the match is found, it obtains the
file’s location from there.
, Let us now study the directory structure with the help of the figure above. The field File
name, contains the name of the concerned file in the directory, Type field indicates the kind or
category of the file, Location Info field indicates the location where the file is stored.
Protection Info field contains the information whether the file can be accessed by the other user
in the system or not. Flag field contains the kind of directory entry like value D in Flag field
indicates that the file is a directory, value L indicates that the file is a link, value M indicates that
the file is a mounted file system.
The Misc info filed in the directory contains the miscellaneous information about the owner of
the file, the time of its creation, the time at which the file was modified last.
Types of Directory Structures
In this section, we will be discussing the most common types of directories, their benefits and
drawbacks.
1. Single-level directory structure
Single level directory structure has only one directory which is called the root directory. The
users are not allowed to create subdirectories under the root directory. All the files created by the
several users are present in the root directory only.
As you can see in the diagram below all the file F1, F2, F3, F4 created by the different users are
present at the root directory.