SR International Institute of Technology
Hyderabad-501301
Submitted by – Kirankumar Torra
Roll no – 23VF1M1243.
Operating Systems Assignment
1. Explain briefly about File Management systems, File system software
Architecture and list the functions of File management
File Management System
A File Management System (FMS) is a component of an operating
system that organizes, stores, retrieves, and manages data on storage
devices. It ensures efficient handling of files and directories, providing
users with an interface to access data easily.
File System Software Architecture
The file system follows a layered architecture, typically consisting of:
1. Application Layer:
o Provides interfaces (GUI or CLI) for users and
applications to interact with files.
2. Logical File System:
o Manages metadata like file names, permissions, and
directory structure.
3. File-Organization Module:
o Implements logical file structure and data access
methods.
4. Basic File System:
o Communicates with the storage device driver to execute
read/write operations.
5. I/O Control Layer:
o Converts file system requests into disk operations and
interacts with device drivers.
6. Storage Device Layer:
o Physical layer that stores data on devices like HDDs,
SSDs, or external drives.
Functions of File Management
1. File Creation and Deletion: o Allows users and applications
to create and remove files as needed.
2. Directory Management:
o Organizes files into directories and subdirectories for
better structure.
3. File Access Control:
o Implements permissions and authentication to prevent
unauthorized access.
4. File Read and Write Operations: o Handles file
input/output operations efficiently.
5. File Backup and Recovery:
o Ensures data integrity by supporting backup and
restoration mechanisms.
6. File Sharing and Security:
o Supports multi-user file sharing while maintaining
access control.
7. Storage Allocation and Management: o Allocates disk
space efficiently and prevents fragmentation.
8. File Naming and Path Management:
o Allows files to be uniquely named and retrieved using
paths.
9. Metadata Management:
o Maintains file attributes like size, type, creation date,
and modification history.
10. Error Detection and Handling:
• Detects file corruption, bad sectors, and other disk-related
errors, ensuring data reliability.
Conclusion
A File Management System is essential for organizing and accessing
data efficiently. Its layered architecture ensures smooth interaction
between users, applications, and hardware, while its functions help
maintain security, accessibility, and performance of file storage.
2. Explain the features of different File organizations methods
File Organization Methods
File organization refers to how records are stored in a file and accessed
efficiently. The choice of file organization depends on factors such as
retrieval speed, storage efficiency, update frequency, and data security.
Criteria to Choose a File Organization Method
1. Access Speed: How quickly records can be retrieved.
2. Storage Efficiency: How efficiently storage space is utilized.
3. Ease of Update: How frequently the file needs modifications.
4. Data Redundancy: Minimizing unnecessary duplication of
data.
5. Flexibility: How easily records can be added, deleted, or
modified.
Five File Organization Methods
1. Pile File Organization
• Definition: The simplest method where records are stored in
the order they arrive, without any specific structure.
• Features:
o Records are added sequentially.
o Searching is slow as it requires scanning the entire file.
o Useful for temporary data storage or unordered
transactions.
• Example: A log file storing error messages as they occur.
2. Sequential File Organization
• Definition: Records are stored in a sorted order based on a
key field.
• Features:
o Efficient for batch processing and reports. o Slow for
searching if the file is large (linear search required).
o Inserting or deleting records requires shifting data.
• Example: Payroll system where employee records are sorted
by ID.
3. Indexed Sequential File Organization
• Definition: A hybrid method where records are stored
sequentially but an index is maintained for faster access.
• Features:
o Combines fast retrieval with sequential storage.
o Index helps in quick searching, reducing lookup time.
o Suitable for applications that require both sequential
and random access.
• Example: Student database with an index based on roll
numbers.
4. Indexed File Organization
• Definition: Uses multiple indexes for efficient record retrieval.
• Features:
o Faster search using multiple indexes (e.g., primary and
secondary indexes).
o Allows quick access to records even in large datasets.
o Requires additional storage for index tables.
• Example: A library CatLog where books are indexed by title,
author, and subject.
5. Direct or Hashed File Organization
• Definition: Uses a hash function to determine the location of
a record.
• Features:
o Fast retrieval as records are accessed using a hash key.
o No need for sequential searching.
o Hash collisions can occur, requiring handling
mechanisms like chaining.
• Example: Banking systems where customer account numbers
are hashed for quick lookup.
Conclusion
Each file organization method has its advantages and is chosen based on
the needs of the application. Sequential and indexed sequential are
useful for ordered data, while hashed files provide the fastest access for
random retrieval. Indexed files balance speed and storage efficiency,
while pile files are simple but inefficient for searching.
3. Define File Directory. Explain its contents. Briefly explain about Tree
structured directory
File Directory
Definition of File Directory
A File Directory is a special system file maintained by the operating
system that stores information about files on a storage device. It helps in
organizing, locating, and managing files efficiently.
Contents of a File Directory
A directory contains metadata (file attributes) and other details about
files, including:
1. File Name – The name assigned to the file.
2. File Type – Specifies whether the file is a document, image,
program, etc.
3. File Location – The address where the file is stored on the
disk.
4. File Size – The amount of space the file occupies.
5. Creation Date and Time – The timestamp when the file was
created.
6. Last Modified Date and Time – The timestamp of the last
modification.
7. Access Permissions – Information on who can read, write, or
execute the file.
8. Owner Information – The user who owns the file.
9. Access Control List (ACL) – Specifies which users or
processes can access the file.
Tree-Structured Directory
Definition
A Tree-structured directory is a hierarchical organization of files and
directories, where directories can contain subdirectories and files, forming
a tree-like structure.
Features of a Tree-Structured Directory
1. Hierarchical Organization – Files and directories are
arranged in a tree structure, with a root directory at the top.
2. Efficient File Searching – Users can navigate through
directories to locate files efficiently.
3. Better Security and Access Control – Different directories
can have specific access permissions.
4. Path Naming – Files can be accessed using absolute or
relative paths.
5. Support for Grouping – Related files can be grouped into
subdirectories.
Advantages of a Tree-Structured Directory
• Organized and Scalable – Helps in managing large amounts
of files efficiently.
• Improved Security – Different levels of access control can be
implemented.
• Easier Navigation – Users can locate and access files
quickly.
Conclusion
A file directory is essential for managing files efficiently, and a
treestructured directory provides a hierarchical way to store and
organize files systematically. This method improves security, file retrieval,
and user accessibility.
4. Explain the issues will arise with File sharing in a Multi user
system. Explain the methods of Record blocking
Issues in File Sharing in a Multi-User System & Record Blocking
Methods
Issues in File Sharing in a Multi-User System
In a multi-user system, multiple users or processes can access the same
file. This leads to various challenges, mainly in access rights and
simultaneous access management.
1. Access Rights & Their Management
To control how users interact with shared files, the operating system
assigns access rights to files. Common access rights include:
Access Right Description
Allows users to view the file content but not modify
Read
it.
Write Allows users to modify the file but not delete it.
Allows users to run the file (applicable for program
Execute
files).
Users can add data to the file but cannot change
Append
existing content.
Access Right Description
Delete Grants permission to delete the file.
Change Allows users to modify access rights for
Permissions others.
Grants all permissions, including
modification, deletion, and access
Full Control control.
Without proper access control, unauthorized modifications or deletions
can lead to data corruption or security breaches.
2. Issues in Simultaneous Access
When multiple users or processes try to access the same file
simultaneously, the following problems may arise:
1. Lost Updates:
▪ If two users modify the same file simultaneously,
one user’s changes might overwrite the others.
▪ Example: Two users updating an inventory file at
the same time, leading to incorrect stock count.
2. Temporary Inconsistencies:
▪ If one process reads a file while another modifies
it, the reader may get an inconsistent view of the data.
▪ Example: A banking system updating account
balances while a customer checks their balance.
3. Deadlocks:
▪ If two processes wait indefinitely for each other to release a file lock,
the system may freeze.
4. Access Prioritization:
▪ Ensuring fair access between users while preventing certain users
from monopolizing a file.
Solution: File locking, version control, and concurrency control techniques
help manage simultaneous access.
Record Blocking
Need for Record Blocking
o A file is stored on disk in blocks rather than individual
records.
o When reading or writing a file, multiple records are
grouped into blocks to improve efficiency and reduce disk
access time.
o The method of record blocking determines how records
are arranged in blocks.
Methods of Record Blocking
1. Fixed-Length Blocking
o Each block contains a fixed number of records of
the same size.
o Simple to implement and easy to manage. o Efficient
when all records are of the same length.
o Example: Database systems storing employee records
with uniform size.
2. Variable-Length Spanned Blocking
o Records can be of different sizes and can span
across multiple blocks.
o No wasted space, as large records can be split across
blocks. o Requires extra processing to manage split records.
o Example: Storing multimedia files, where a single
record may be too large for one block.
3. Variable-Length Unspanned Blocking
o Each record is stored within a single block and
does not span across multiple blocks.
o Some space may be wasted if a block is not fully used. o
Faster access since no record splitting is needed.
o Example: File systems storing documents where each
record fits within a block.
Conclusion
File sharing in multi-user systems requires proper access control and
synchronization to prevent data loss or corruption. Record blocking
improves storage efficiency by grouping records into blocks, with different
methods catering to different types of files and applications.
5. Explain the different File Allocation methods with suitable
examples.
File Allocation Methods
Introduction
File allocation refers to how disk space is assigned to files on a storage
device. The method used affects file access speed, disk utilization, and
fragmentation. The three common file allocation methods are
Contiguous Allocation, Chained Allocation, and Indexed
Allocation.
1. Contiguous Allocation
Definition
• Each file is stored in a single, continuous block of disk space.
• The starting block and the length of the file are recorded in the file
table.
Example
File Name Start Block Length (Blocks)
File A 10 4
File B 14 6
Here, File A occupies blocks 10 to 13, and File B occupies blocks 14 to
19.
Advantages
Fast access as all blocks are in sequence.
Simple to implement.
Disadvantages
External fragmentation occurs when free space is scattered.
File expansion is difficult since adjacent blocks may be occupied.
Use Case
• Used in CD-ROMs and DVDs where file sizes are fixed and do
not change.
2. Chained Allocation (Linked Allocation)
Definition
• Each file is stored as a linked list of disk blocks.
• The first block contains a pointer to the next block, and so on.
• The last block contains a NULL pointer.
Example
File Name Start Block Block Sequence
File X 5 5 → 11 → 2 → 8 → NULL
7 → 15 → 19 → 6 →
File Y 7 NULL
Here, File X starts at block 5 and continues in scattered locations using
pointers.
Advantages
No external fragmentation since any available block can be used.
Files can grow dynamically without needing contiguous space.
Disadvantages
Slower access since each block must be read sequentially.
Extra space is used for pointers.
Use Case
• Suitable for floppy disks and small file systems where random
access is not required.
2. Indexed Allocation
Definition
• A separate index block is used to store pointers to all the
blocks of a file.
• The file system maintains an index table that maps files to
their disk blocks.
Example
File Name Index Block Block List
File M 4 9, 2, 7, 15
File N 6 5, 13, 10, 8
Here, File M has an index block at 4, which lists blocks 9, 2, 7, and 15.
Advantages
Fast random access, as any block can be accessed directly via the index.
No fragmentation since any available block can be assigned.
Disadvantages
Extra space is needed for index blocks.
If the index block is lost, the entire file becomes inaccessible.
Use Case
• Used in UNIX file systems and NTFS, where quick file access is
required.
Conclusion
Each file allocation method has its strengths and weaknesses:
• Contiguous allocation provides fast access but suffers from
fragmentation.
• Chained allocation is flexible but slower due to pointer
traversal.
• Indexed allocation offers fast access but requires extra
storage for index tables.
The choice of file allocation method depends on the system's speed,
storage efficiency, and file access requirements.