0% found this document useful (0 votes)
23 views10 pages

OSY_6th unit Notes

The document covers file management concepts including file attributes, operations, access methods (sequential and direct), swapping, file allocation methods (contiguous, linked, indexed), and directory structures (single-level, two-level, tree). It details the advantages and disadvantages of each method and structure, emphasizing their efficiency, complexity, and suitability for different applications. Overall, it serves as a comprehensive guide to understanding file management in operating systems.

Uploaded by

Gajanan Markad
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)
23 views10 pages

OSY_6th unit Notes

The document covers file management concepts including file attributes, operations, access methods (sequential and direct), swapping, file allocation methods (contiguous, linked, indexed), and directory structures (single-level, two-level, tree). It details the advantages and disadvantages of each method and structure, emphasizing their efficiency, complexity, and suitability for different applications. Overall, it serves as a comprehensive guide to understanding file management in operating systems.

Uploaded by

Gajanan Markad
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/ 10

Unit 6: File Management

Q.1] What is Attribute of file


1. Name: File name is the name given to the file. A name is usually a string
of characters.
2. Identifier: Identifier is a unique number for a file. It identifies files within
the file system. It is not readable to us, unlike file names.
3. Type: Type is another attribute of a file which specifies the type of file
such as archive file (.zip), source code file (.c, .java), .docx file, .txt file,
etc.
4. Location: Specifies the location of the file on the device (The directory
path). This attribute is a pointer to a device.
5. Size: Specifies the current size of the file (in Kb, Mb, Gb, etc.) and possibly
the maximum allowed size of the file.
6. Protection: Specifies information about Access control (Permissions
about Who can read, edit, write, and execute the file.) It provides security
to sensitive and private information.
7. Time, date, and user identification: This information tells us about the
date and time on which the file was created, last modified, created and
modified by which user, etc.

Q.2] List file operations.


1) Create File
2) Write File
3) Read File
4) Delete File
5) Open File
6) Rename File
7) Search File
8) Copy File
Q.3] Explain Access Methods. Describe sequential and direct access method.
File Access Methods
1. Sequential-Access
2. Direct Access
1] Sequential Access Method:
▪ Data is read or written in a fixed, linear order, from start to finish.
▪ It is simple to implement, requiring no complex indexing or pointers.
▪ Best suited for applications that process data in sequence, like logs or
backups.
▪ Accessing specific records can be slow, as it requires reading through all
previous data.
▪ It is resource-efficient, needing minimal system overhead.
▪ Not ideal for real-time applications that need fast random access to data.

Fig. Sequential-Access Method


Advantages of Sequential Access Methods:
1. Simple and easy to implement.
2. Efficient for large, ordered datasets.
3. Low resource usage.
4. Good for continuous processing.
Disadvantages of Sequential Access Methods:
1. Slow for specific data access.
2. Inefficient for random retrieval.
3. Longer wait times for non-sequential data.
4. Not ideal for real-time applications.
2] Direct Access Method:
▪ Data can be accessed directly at any location within the file without
sequential reading.
▪ Ideal for applications like databases that require quick, random access to
specific records.
▪ Offers faster access to specific records compared to sequential access.
▪ More complex to implement, requiring indexing or pointers to manage
access.
▪ Consumes more system resources due to the need for maintaining indexes
and data structures.
▪ Can be inefficient for purely sequential tasks due to the overhead of
managing access methods.
Advantages of Direct Access Method:
1. Fast data retrieval.
2. Ideal for random access.
3. Great for real-time apps.
4. Efficient for unpredictable access.
Disadvantages of Direct Access Method:
1. More complex to implement.
2. Higher resource use.
3. Inefficient for sequential data.
4. Can cause fragmentation.
Q.4] Explain Swapping
Swapping:

Advantages of Swapping:
1. Runs more programs than available RAM.
2. Prevents crashes when RAM is full.
3. Reduces need for extra RAM.
4. Supports large apps with limited memory.
Disadvantages of Swapping:
1. Slows down the system.
2. Causes lag with large swaps.
3. Inefficient for small swaps.
4. Can lead to thrashing.
Q.5] Explain File Allocation Method
1. Contiguous Allocation
2. Linked Allocation
3. Indexed Allocation

1] Contiguous Allocation:
▪ If the blocks are allocated to the file in such a way that all the logical blocks
of the file get the contiguous physical block in the hard disk then such
allocation scheme is known as contiguous allocation.
▪ In the image shown below, there are three files in the directory.
▪ The starting block and the length of each file are mentioned in the table.
▪ We can check in the table that the contiguous blocks are assigned to each
file as per its need.

Advantages of Contiguous Allocation:


1. It is simple to implement.
2. We will get Excellent read performance.
Disadvantages of Contiguous Allocation:
1. The disk will become fragmented.
2. It may be difficult to have a file grow.
2] Linked Allocation:
▪ Linked List allocation solves all problems of contiguous allocation.
▪ In linked list allocation, each file is considered as the linked list of disk
blocks.
▪ However, the disks blocks allocated to a particular file need not to be
contiguous on the disk.
▪ Each disk block allocated to a file contains a pointer which points to the
next disk block allocated to the same file.

Advantages of Linked Allocation:


1. There is no external fragmentation with linked allocation.
2. Any free block can be utilized in order to satisfy the file block requests.
3. File can continue to grow as long as the free blocks are available.
4. Directory entry will only contain the starting block address.
Disadvantages of Linked Allocation:
1. Random Access is not provided.
2. Pointers require some space in the disk blocks.
3. Any of the pointers in the linked list must not be broken otherwise the file
will get corrupted.
4. Need to traverse each block.
3] Indexed Allocation:
Indexed allocation uses an index block to store pointers to
a file’s data blocks, allowing non-contiguous storage.
▪ It enables random access to data by referencing pointers in the index block.
▪ Files can grow or shrink dynamically, with the index block updated as
needed.
▪ It eliminates fragmentation by allowing scattered data blocks.
▪ There’s overhead as each file requires an index block, and large files may
need multiple index blocks.

Advantages of Indexed Allocation:


1. Supports direct access
2. A bad data block causes the lost of only that block.
Disadvantages of Indexed Allocation:
1. A bad index block could cause the lost of entire file.
2. Size of a file depends upon the number of pointers, a index block can
hold.
3. Having an index block for a small file is totally wastage.
4. More pointer overhead
Q.6] Explain Directory Structure
1. Single-Level Directory
2. Two-Level Directory
3. Tree Structure/ Hierarchical Structure
1] Single-Level Directory
▪ The single-level directory is the simplest directory structure. In it, all
files are contained in the same directory which makes it easy to support
and understand.
▪ A single level directory has a significant limitation, however, when the
number of files increases or when the system has more than one user.
Since all the files are in the same directory, they must have a unique
name. If two users call their dataset test, then the unique name rule
violated.

Advantages of Single level directory:


1. Simple to implement.
2. Easy to navigate.
3. Low overhead.
4. Fast access.

Disadvantages of Single level directory:


1. Limited scalability.
2. Name conflicts.
3. Hard to manage large files.
4. Lack of organization.
2] Two-Level Directory:
▪ The two-level directory structure is a simple yet effective way to organize
files in an operating system. In this type of structure, each user is assigned
their own personal directory, known as the user directory or home
directory. This directory serves as the top-level directory for that user and
contains all of their personal files and subdirectories.
▪ In the two-level directory structure, each user has their own user files
directory (UFD). The UFDs have similar structures, but each list only the
files of a single user. System’s master file directory (MFD) is searched
whenever a new user id is created.
▪ For example, a user might create subdirectories for different projects,
categories of files, or specific time periods. This allows for a more granular
organization system and makes it easier to locate specific files when
needed.

Advantages of Two-level Directory:


1. Organizes files into user-specific directories.
2. Reduces name conflicts.
3. Easier to manage multiple users.
4. Simple structure.

Disadvantages of Two-level Directory:


1. Limited hierarchy.
2. Inefficient with many users/files.
3. Lack of further organization.
4. Difficult for large user bases.
3] Tree Structure/ Hierarchical Structure:
▪ Tree directory structure of operating system is most commonly used in
our personal computers. User can create files and subdirectories too,
which was a disadvantage in the previous directory structures.
▪ This directory structure resembles a real tree upside down, where the root
directory is at the peak. This root contains all the directories for each user.
The users can create subdirectories and even store files in their directory.
▪ A user does not have access to the root directory data and cannot modify
it. And, even in this directory the user does not have access to other user’s
directories. The structure of tree directory is given below which shows
how there are files and subdirectories in each user’s directory.

Advantages of Tree Structure:


1. Flexible and scalable organization.
2. Easy to navigate with paths.
3. Efficient for large systems.
4. Reduces name conflicts.
Disadvantages of Tree Structure:
1. Complex to implement.
2. Slower access due to deep traversal.
3. Overhead of maintaining structure.
4. Can get complicated with too many sublevels.

You might also like