Information Management
Information Management
Information Management
File Systems in Operating 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.
1
OPERATING SYSTEM (BCA-402) Unit 5
File structure
A File Structure needs to be predefined format in such a way that an operating
system understands. It has an exclusively defined structure, which is based on its
type.
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.
File Type
It refers to the ability of the operating system to differentiate various types of files
like text files, binary, and source files. However, Operating systems like MS_DOS
and UNIX has the following type of files:
2
OPERATING SYSTEM (BCA-402) Unit 5
Ordinary files
Directory Files
Directory contains files and other related information about those files. Its
basically a folder to hold and organize multiple files.
Special Files
These files are also called device files. It represents physical devices like
printers, disks, networks, flash drive, etc.
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.
DATABASE:
Collection of related data is called a database. Relationships among elements of
data are explicit.
3
OPERATING SYSTEM (BCA-402) Unit 5
FILES:
Files is the collection of similar record which is treated as a single entity.
RECORD:
A Record type is a complex data type that allows the programmer to create a new
data type with the desired column structure. Its groups one or more columns to
form a new data type. These columns will have their own names and data type.
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
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.
Indexed sequential access
4
OPERATING SYSTEM (BCA-402) Unit 5
Index is searched sequentially and its pointer is used to access the file directly.
Space Allocation
In the Operating system, files are always allocated disk spaces.
Linked Allocation
Indexed Allocation
Contiguous Allocation
Contiguous Allocation
In this method,
Linked Allocation
In this method,
Indexed Allocation
In this method,
5
OPERATING SYSTEM (BCA-402) Unit 5
File Directories
A single directory may or may not contain multiple files. It can also have sub-
directories inside the main directory. Information about files is maintained by
Directories. In Windows OS, it is called folders.
6
OPERATING SYSTEM (BCA-402) Unit 5
Setting Permissions
Operating systems control the file access by setting permissions for files and
directories. Permissions can be set to grant or deny access to specific files and
directories. When permission is granted, you can access and perform any function
on the file or directory. When permission is denied, you cannot access that file or
directory. The most common permissions are read, write, delete, and execute.
7
OPERATING SYSTEM (BCA-402) Unit 5
Write allows a user to open the file or directory, make changes, and save
those changes.
Delete allows a user to delete the file or directory.
Execute allows a user to run an executable file. Certain files are executable
files, usually ending in .exe or .com, which starts an application on your
computer.
Combining Permissions
Permissions can be combined to allow and deny specific functions. Suppose you're
working on a budget and want Sally's input. You can share the budget directory
with Sally and grant her read and write permissions. However, you do not want
Sally to accidentally delete the budget directory or any files, so you can deny the
delete permission.
Logical File System Overview
The logical file system is the level of the file system at which users can request file
operations by system call. This level of the file system provides the kernel with a
consistent view of what might be multiple physical file systems and multiple file
system implementations. As far as the logical file system is concerned, file system
types, whether local, remote, or strictly logical, and regardless of implementation,
are indistinguishable.
Logical file system can also refer to the tree of known path names in force while
the system is running.
8
OPERATING SYSTEM (BCA-402) Unit 5
To take the advantages of various file systems on the different operating systems,
we can divide the hard disk into multiple partitions, which are of different sizes.
Partitions are known as minidisks or volumes.
There should be at least one directory that must be present in each partition.
Through it, we can list all the files of the partition. In the directory for each file,
there is a directory entry, which is maintained, and in that directory entry, all the
information related to the file is stored.
9
OPERATING SYSTEM (BCA-402) Unit 5
3. Location
4. Size
5. Position
6. Protection
7. Usage
8. Mounting
1. Name: – Name is the name of the directory, which is visible to the user.
2. Type: – Type of a directory means what type of directory is present such as
single-level directory, two-level directory, tree-structured directory, and
Acyclic graph directory.
3. Location: – Location is the location of the device where the header of a file
is located.
4. Size: – Size means number of words/blocks/bytes in the file.
5. Position: – Position means the position of the next-read pointer and the
next-write pointer.
6. Protection: – Protection means access control on the
read/write/delete/execute.
7. Usage: – Usage means the time of creation, modification, and access, etc.
8. Mounting: – Mounting means if the root of a file system is grafted into the
existing tree of other file systems.
Operations on Directory
The various types of operations on the directory are:
1. Creating
2. Deleting
3. Searching
4. List a directory
5. Renaming
6. Link
7. Unlink
1. Creating: – In this operation, a directory is created. The name of the
directory should be unique.
10
OPERATING SYSTEM (BCA-402) Unit 5
2. Deleting: – If there is a file that we don’t need, then we can delete that file
from the directory. We can also remove the whole directory if the directory
is not required. An empty directory can also be deleted. An empty directory
is a directory that only consists of dot and dot-dot.
3. Searching: – Searching operation means, for a specific file or another
directory, we can search a directory.
4. List a directory: – In this operation, we can retrieve all the files list in the
directory. And we can also retrieve the content of the directory entry for
every file present in the list.
If in the directory, we want to read the list of all files, then first, it should be
opened, and afterwards we read the directory, it is a must to close the directory so
that the internal tablespace can be free up.
11
OPERATING SYSTEM (BCA-402) Unit 5
Two-Level Directory
Two-Level Directory is another type of directory structure. In this, it is possible to
create an individual directory for each of the users. There is one master node in the
two-level directory that include an individual directory for every user. At the
second level of the directory, there is a different directory present for each of the
users. Without permission, no user can enter into the other user’s directory.
12
OPERATING SYSTEM (BCA-402) Unit 5
13
OPERATING SYSTEM (BCA-402) Unit 5
Tree-Structured Directory
A Tree-structured directory is another type of directory structure in which the
directory entry may be a sub-directory or a file. The tree-structured directory
reduces the limitations of the two-level directory. We can group the same type of
files into one directory.
In a tree-structured directory, there is an own directory of each user, and any user
is not allowed to enter into the directory of another user. Although the user can
read the data of root, the user cannot modify or write it. The system administrator
only has full access to the root directory. In this, searching is quite effective and we
use the current working concept. We can access the file by using two kinds of
paths, either absolute or relative.
Relative Path : It is defined as the path related to present working directory (pwd).
Ex : joe/foo
14
OPERATING SYSTEM (BCA-402) Unit 5
Relative path make use of two special symbols, a dot(.) and double dot(..).
The relative path begins with a dot(.), representing the current directory (also
called the “working directory”).
15
OPERATING SYSTEM (BCA-402) Unit 5
General-Graph Directory
The General-Graph directory is another vital type of directory structure. In this
type of directory, within a directory we can create cycle of the directory where we
can derive the various directory with the help of more than one parent directory.
The main issue in the general-graph directory is to calculate the total space or size,
taken by the directories and the files.
16
OPERATING SYSTEM (BCA-402) Unit 5
17