0% found this document useful (0 votes)
11 views17 pages

Information Management

The document outlines the key aspects of file systems in operating systems, including objectives, structures, attributes, and access methods. It discusses various file types, directory structures, and file access control mechanisms, emphasizing the importance of managing files and directories effectively. Additionally, it covers space allocation methods and the logical file system's role in providing a consistent interface for file operations.

Uploaded by

Isha Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views17 pages

Information Management

The document outlines the key aspects of file systems in operating systems, including objectives, structures, attributes, and access methods. It discusses various file types, directory structures, and file access control mechanisms, emphasizing the importance of managing files and directories effectively. Additionally, it covers space allocation methods and the logical file system's role in providing a consistent interface for file operations.

Uploaded by

Isha Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

OPERATING SYSTEM (BCA-402) Unit 5

Information Management
File Systems in Operating System

The main objectives of the file management system:

 It provides I/O support for a variety of storage device types.


 Minimizes the chances of lost or destroyed data
 Helps OS to standardized I/O interface routines for user processes.
 It provides I/O support for multiple users in a multiuser systems
environment.

What is File System?


A file is a collection of correlated information which is recorded on secondary or
non-volatile storage like magnetic disks, optical disks, and tapes. It is a method of
data collection that is used as a medium for giving input and receiving output from
that program.

In general, a file is a sequence of bits, bytes, or records whose meaning is defined


by the file creator and user. Every File has a logical location where they are located
for storage and retrieval.

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.

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.

Three types of files structure in OS:

 A text file: It is a series of characters that is organized in lines.


 An object file: It is a series of bytes that is organized into blocks.
 A source file: It is a series of functions and processes.

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

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

Character Special File


It is a hardware file that reads or writes data character by character, like mouse,
printer, and more.

Ordinary files

 These types of files stores user information.


 It may be text, executable programs, and databases.
 It allows the user to perform operations like add, delete, and modify.

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.

Commonly used terms in File systems


Field:
This element stores a single value, which can be static or variable length.

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.

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
 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

 This mechanism is built up on base of sequential access.


 An index is created for each file which contains pointers to various blocks.

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.

Three types of space allocation methods are:

 Linked Allocation
 Indexed Allocation
 Contiguous Allocation

Contiguous Allocation
In this method,

 Every file users a contiguous address space on memory.


 Here, the OS assigns disk address is in linear order.
 In the contiguous allocation method, external fragmentation is the biggest
issue.

Linked Allocation
In this method,

 Every file includes a list of links.


 The directory contains a link or pointer in the first block of a file.
 With this method, there is no external fragmentation
 This File allocation method is used for sequential access files.
 This method is not ideal for a direct access file.

Indexed Allocation
In this method,

 Directory comprises the addresses of index blocks of the specific files.


 An index block is created, having all the pointers for specific files.
 All files should have individual index blocks to store the addresses for disk
space.

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.

Following is the information which is maintained in a directory:

 Name The name which is displayed to the user.


 Type: Type of the directory.
 Position: Current next-read/write pointers.
 Location: Location on the device where the file header is stored.
 Size: Number of bytes, block, and words in the file.
 Protection: Access control on read/write/execute/delete.
 Usage: Time of creation, access, modification

6
OPERATING SYSTEM (BCA-402) Unit 5

File Access Control


File access control functions much like a bank. Inside your local bank is a vault
with safety deposit boxes where you can store your valuables, such as the deed to
your home, knowing that no one can access that deed without access to the vault
and the key to your safety deposit box. In a similar manner, important computer
files can be protected by the operating system's file access control feature. In this
lesson, we'll explore how an operating system can protect or allow access to files
and directories.

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.

 Read allows a user to open and read a file or directory.

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.

Permission can be granted or denied to one person at a time or to a group of


people. Let's say you're working with a group of 100 people and you want to allow
only 20 of those people to have access to your budget directory. You could apply
permission to each person individually, but that's a bit time-consuming. In these
cases, it's better to create a group in the User Manager console, add those 20 people
to the group, and then grant or deny permissions to the entire group.

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.

A consistent view of file system implementations is made possible by the virtual


file system abstraction. This abstraction specifies the set of file system operations
that an implementation must include in order to carry out logical file system
requests. Physical file systems can differ in how they implement these predefined
operations, but they must present a uniform interface to the logical file system.

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

Directory Structure in Operating System


What is a Directory
A Directory is the collection of the correlated files on the disk. In simple words, a
directory is like a container which contains file and folder. In a directory, we can
store the complete file attributes or some attributes of the file. A directory can be
comprised of various files. With the help of the directory, we can maintain the
information related to the files.

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.

There are various types of information which are stored in a directory:


1. Name
2. Type

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.

Types of Directory Structure

There are various types of directory structure:


1. Single-Level Directory
2. Two-Level Directory
3. Tree-Structured Directory
4. Acyclic Graph Directory
5. General-Graph Directory
6. Single-Level Directory: – Single-Level Directory is the easiest directory
structure. There is only one directory in a single-level directory, and that
directory is called a root directory. In a single-level directory, all the files are
present in one directory that makes it easy to understand. In this, under the
root directory, the user cannot create the subdirectories.

11
OPERATING SYSTEM (BCA-402) Unit 5

The advantages of the single-level directory are:


1. The implementation of a single-level directory is so easy.
2. In a single-level directory, if all the files have a small size, then due to this,
the searching of the files will be easy.
3. In a single-Level directory, the operations such as searching, creation,
deletion, and updating can be performed.

The disadvantages of Single-Level Directory are:


1. If the size of the directory is large in Single-Level Directory, then the
searching will be tough.
2. In a single-level directory, we cannot group the similar type of files.
3. Another disadvantage of a single-level directory is that there is a possibility
of collision because the two files cannot have the same name.
4. The task of choosing the unique file name is a little bit complex.

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

The characteristics of the two-level directory are:


1. In a two-level directory, there may be same file name of different users.
2. There is a pathname of each file such as /User-name/directory-name/
3. In a two-level directory, we cannot group the files which are having the
same name into a single directory for a specific user.
4. In a two-level directory, searching is more effective because there is only
one user’s list, which is required to be traversed.

The advantages of the two-level directory are:


1. In the two-level directory, various users have the same file name and also
directory name.
2. Because of using the user-grouping and pathname, searching of files are
quite easy.
The disadvantages of the two-level directory are:
1. In a two-level directory, one user cannot share the file with another user.
2. Another disadvantage with the two-level directory is it is not scalable.

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.

Absolute and Relative Path

Absolute Path : It is defined as specifying the location of a file or directory from


the root directory(/) ex: /home/sh/report

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(..).

.(a single dot) represent the current directory

..(two dots) represents the parent directory.

The relative path begins with a dot(.), representing the current directory (also
called the “working directory”).

Advantages of tree-structured directory


The advantages of the tree-structured directory are:
1. The tree-structured directory is very scalable.
2. In the tree-structures directory, the chances of collision are less.
3. In the tree-structure directory, the searching is quite easy because, in this, we
can use both types of paths, which are the absolute path and relative path.

Disadvantages of Tree-Structure Directory


The disadvantages of tree-structure directory are:
1. In the tree-structure directory, the files cannot be shared.
2. Tree-structure directory is not efficient because, in this, if we want to access
a file, then it may go under multiple directories.
3. Another disadvantage of the tree-structure directory is that each file does not
fit into the hierarchal model. We have to save the files into various
directories.
Acyclic-Graph Directory
In the tree-structure directory, the same files cannot exist in the multiple
directories, so sharing the files is the main problem in the tree-structure directory.
With the help of the acyclic-graph directory, we can provide the sharing of files. In
the acyclic-graph directory, more than one directory can point to a similar file or
subdirectory. We can share those files among the two directory entries.
With the help of aliases, and links, we can create this type of directory graph. We
may also have a different path for the same file. Links may be of two kinds, which
are hard link (physical) and symbolic (logical).

15
OPERATING SYSTEM (BCA-402) Unit 5

If we delete the files in acyclic graph structures, then


1. In the hard link (physical) case, we can remove the actual files only if all the
references to the file are deleted.
2. In the symbolic link (logical) case, we just delete the file, and there is only a
dangling point that is left.
3.
The advantages of the acyclic-graph directory are:
1. In the acyclic-graph directory, the sharing of files is possible.
2. In the acyclic-graph directory, because of different-different paths, searching
is easy.
The disadvantages of acyclic-graph directory are:
1. If the files are shared through linking, there may be a problem in the case of
deleting.
2. If we are using soft link, then in this case, if the file is deleted then there is
only a dangling pointer which is left.
3. If we are using hardlink, in this case, when we delete a file, then we also
have to remove all the reference connected with it.

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

The advantages of general-graph directory are:


1. The General-Graph directory is more flexible than the other directory
structure.
2. Cycles are allowed in the general-graph directory.
The disadvantages of general-graph directory are:
1. In general-graph directory, garbage collection is required.
2. General-graph directory is more costly, among other directory structures.

17

You might also like