0% found this document useful (0 votes)
25 views63 pages

Os Unit 5 Part 1

Uploaded by

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

Os Unit 5 Part 1

Uploaded by

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

Concept of File Management

UNIT- 5
Topics
5.1 Introduction to file management
5.2 File naming
5.3 File operation
5.4 File extension
5.5 File system layout
5.6 File allocation: Contiguous, Index
5.7 Free space management
Introduction to File Management in
an Operating System
• File management is a fundamental aspect of any
operating system (OS).
• It refers to the processes and techniques used to
create, organize, access, modify, and delete files and
folders stored on a computer's storage devices.
• Here's a basic overview of this crucial component:
What are files?
• Files are digital containers that hold information,
such as documents, images, videos, music,
applications, and more.
• Each file has a unique name and is associated with a
specific type, like .txt for plain text or .exe for
executable programs.
What are folders?

• Folders are virtual containers used to organize


files. They act as directories, grouping related files
together for easier access and management.
• You can create subfolders within folders to further
organize your data.
Basic operations:

• Creating: Making new files and folders.


• Accessing: Opening and viewing the contents of files and
folders.
• Modifying: Editing or changing the contents of files.
• Deleting: Removing unwanted files and folders.
• Moving: Transferring files and folders to different locations.
• Copying: Creating duplicates of files and folders.
File Systems:
• The organization of files and folders on a storage
device is governed by a file system.
• Common file systems include FAT32, NTFS, exFAT, and
HFS+.
• These systems define how data is stored on the disk,
manage disk space, and ensure efficient file access.
File System:
• The file system is the underlying
structure that the operating system
uses to manage files and directories.
• It defines the rules and methods for
storing and retrieving data on storage
devices.
Files and Directories:

• A file is a named collection of data with


specific attributes, such as size, type,
and permissions.
• Directories, also known as folders, are
containers used to organize and group
related files.
File Attributes:
• Each file or folder has associated attributes, like size,
date created, date modified, and permissions.
• These attributes provide information about the file
and control who can access or modify it.
Tools and Interfaces:

• Operating systems provide various tools and interfaces


to manage files.
• Graphical user interfaces (GUIs) offer drag-and-drop
functionality and file explorer applications for browsing
and organizing files.
• Command-line interfaces (CLIs) offer text-based
commands for experienced users to perform file
operations.
Importance of File Management:

• Proper file management is crucial for keeping your


computer organized, efficient, and secure.
• It helps you find files quickly, avoid clutter, prevent
data loss, and control access to sensitive information.
Advance Concept
• Beyond the basics, file management involves several
advanced concepts like file compression, data
encryption, file sharing, backup and recovery, and
version control. These features ensure efficient
storage, secure collaboration, and protection against
data loss.
Introduction to file management
• File management in an operating system
refers to the processes and techniques
involved in creating, organizing, accessing,
manipulating, and controlling files stored on
storage devices.
• It includes tasks such as file creation,
deletion, naming, classification, and access
control.
• File management in an operating system
refers to the set of processes and techniques
involved in creating, organizing, accessing,
manipulating, and controlling files stored on
storage devices such as hard drives, solid-
state drives, or network storage.
• It encompasses a range of tasks and
functionalities that ensure efficient handling
of files, including their creation, deletion,
naming, classification, and protection.
• File management in an operating system is a
critical component that governs how data is
organized, stored, accessed, and
manipulated on a computer's storage
devices.
• It provides a systematic way of handling files,
directories (folders), and the overall file
system structure.
• Here's an introduction to file management
within an operating system:
File Naming
• Refers to the process of assigning a unique name to a file.
• File names should be descriptive and relevant to the
content of the file.
• Operating systems typically enforce certain naming rules,
such as limiting length, prohibiting certain characters,
and requiring unique names within a folder.
• The image you sent might show examples of file names
like "README.txt", "image.jpg", or "document.docx",
each describing the respective file type and content.
File Operation:
• Actions: Any task like creating, opening, modifying, deleting,
moving, copying, or renaming files.
• Tools: Operating systems provide graphical interfaces (GUIs)
like file explorers and command-line interfaces (CLIs) for
performing these operations.
• Examples: Clicking a "delete" icon next to a file or dragging
and dropping a file to another folder are file operations.
• Importance: Enables manipulation and interaction with files
for various purposes like editing, storing, and sharing data.
File Operations
Types of File Operations:
There are numerous file operations, but some of the most
common include:

• Create: Generating a new file with a chosen name and


type. This could involve writing text to a document,
recording audio into a file, or capturing an image.
• Open: Accessing the contents of an existing file for
viewing, editing, or processing. This might involve
launching a document in a word processor, playing a
music file, or displaying an image.
• Read: Extracting information from a file without
modifying its contents. This could involve displaying the
text in a document, listening to the music in a file, or
viewing the pixels in an image.
• Write: Modifying the contents of a file by adding,
deleting, or changing data. This might involve typing text
into a document, editing the sounds in a music file, or
enhancing the colors in an image.
• Delete: Permanently removing a file from the storage
device, freeing up space and potentially recovering it
later.
• Move: Changing the location of a file within the storage
device, typically by placing it in a different folder or
• Copy: Creating an identical duplicate of a file, allowing
you to have the same data in multiple locations.
• Rename: Changing the name of a file, which can help
with identification and organization.
• Search: Locating specific files based on their names,
extensions, content, or other criteria.
• Backup: Creating a copy of a file or group of files for
safekeeping in case the originals are lost or damaged.
• Compress: Reducing the size of a file for efficient
storage or transmission by removing redundant data.
• Decompress: Expanding a compressed file back to its
original size for access and use.
File Extension:

• Function: Identifies the file type and associates it with


the appropriate program for opening and editing.
• Format: Typically a suffix at the end of the file name,
separated by a period (.).
• Examples: ".txt" for text files, ".jpg" for images, ".mp3"
for music, and ".exe" for executable programs.
• Importance: Ensures files are opened by the correct
program, preventing errors and data corruption.
File System Layout:

• Structure: The organization of files and folders on a storage


device.
• Types: Various file systems exist, like FAT32, NTFS, exFAT, and
HFS+, each with its own way of managing data and allocating
space.
• Common Layout: Hierarchical structure with nested folders,
allowing for organized grouping of related files under a root
directory.
• Benefits: Improves data organization, facilitates efficient
storage utilization, and simplifies file access and management.
Components of a File System Layout:
• Root directory: The topmost level of the directory
structure, acting as the starting point for navigating all
other folders and files.
• Directories: Folders that group related files
together, providing organization and facilitating
access. Directories can contain subdirectories for further
organization.
• Files: The actual data containers storing information like
documents, images, videos, music, and
applications. Each file has a unique name and extension.
• File allocation table (FAT): (Applicable to FAT file
systems) A table that maps the location of data
clusters on the storage device, indicating which
clusters belong to each file.
• Inodes: (Applicable to Unix-like file systems) Data
structures containing information about
files, including their location, size, permissions, and
other attributes.
• Superblock: (Applicable to most file systems) A block
containing essential information about the file
system, like its size, format, and available space.
Common File System Layouts:
• Hierarchical: The most common layout, resembling a
tree structure with the root directory at the
top, followed by nested subdirectories and files. This
provides a familiar and intuitive way to organize data.
• Flat: All files reside directly in the root directory, without
any subdirectories. This approach is simple but can
become cumbersome with a large number of files.
• Partitioned: The storage device is divided into sections
called partitions, each with its own file system. This
allows for separate operating systems or data storage on
the same device.
Factors Affecting File System Layout:

• Operating system: Different operating systems use


different file systems with varying layouts and
capabilities.
• Storage device type: Hard disk drives (HDDs) and
solid-state drives (SSDs) have different characteristics
that influence file system choice.
• Data organization needs: The type and amount of
data being stored determine the optimal file system
layout for efficient access and management.
File allocation: Contiguous, Index

 The allocation methods define how the files are


stored in the disk blocks.
 File allocation refers to the methods used by file
systems to organize and store files on a storage
device.
There are three main disk space or file allocation
methods.
• Contiguous Allocation
• Linked Allocation
The main idea behind these methods is to provide:

• Efficient disk space utilization.


• Fast access to the file blocks.
Contiguous Allocation

• In contiguous allocation, each file occupies a contiguous block


of storage space on the storage medium. This means that all
the blocks of a file are stored together in a consecutive manner.
• The main advantage of contiguous allocation is simplicity and
ease of access. Reading and writing to a file are relatively
straightforward because the data is stored in a continuous
block.
• However, one major drawback is that it can lead to
fragmentation. Over time, as files are created and deleted, free
blocks of space become scattered, and it might be challenging
to find contiguous space for a new file.
Example
• Suppose you have a storage medium divided
into blocks, and each block can hold one unit
of data. Let's say we want to store a file
"file.txt" that requires three blocks.

• In contiguous allocation, the file would be


stored as follows:
• | Block 1 | Block 2 | Block 3 |
|-----------|-----------|-----------|
• | file.txt |
• Here, the entire file is stored in contiguous
blocks, making it straightforward to read and
write the file. However, if another file is
deleted, leaving a gap, it might be challenging
to find contiguous space for a new file.
• Example: Imagine a file stored in blocks
5, 6, 7, and 8. This means it holds those
four consecutive blocks and no others.
• According to this strategy, every file that resides in a memory
block takes up a contiguous, or continuous, collection of memory
blocks.

• For file F1, let's say the beginning address is 1 and the number of
memory blocks needed is 3. After then, it will be kept at b[1],
b[2], and b[3].

• Every file will contain a directory entry with the information listed
below:

• Location of the starting block


• File space requirements in terms of memory blocks
The file ‘mail’ in
the following
figure starts from
the block 19 with
length = 6
blocks.
Therefore, it
occupies 19, 20,
21, 22, 23,
24 blocks.
Advantages:
• Fast access, especially for sequential reading and writing

• Simple to implement

• Sequential Access: Reading and writing to a file are generally faster when
the data blocks are stored contiguously. Sequential access is efficient.

• Simplicity: Contiguous allocation is straightforward to implement and


manage. The file system doesn't need to maintain complex data structures.

• Reduced Overhead: There is minimal overhead in terms of additional data


structures, which can result in more efficient use of storage space
Disadvantages:

• Fragmentation: Contiguous allocation is susceptible to


fragmentation, both internal (unused space within a
block) and external (free space scattered across the disk).
• File Expansion: Expanding a file can be challenging if
contiguous space is not available. This can lead to file
fragmentation and additional overhead in managing
space.
• Wastage of Space: There might be some wasted space
due to the allocation of entire blocks, even if the file does
not fully occupy them
• Older operating systems like MS-DOS used
contiguous allocation.
• Still used in certain specialized systems, such
as real-time systems or systems with limited
disk space, where sequential access and
simplicity are crucial.
Index Allocation:
In index allocation, each file has its own index block. The index block
contains pointers to the actual data blocks of the file.

The index block serves as a table of contents for the file, pointing to
the locations of its data blocks on the storage medium.

This method helps in reducing fragmentation since the data blocks of a


file are not required to be stored consecutively. Instead, the index
block keeps track of the scattered data blocks.

Index allocation is more flexible than contiguous allocation


and allows for easier file expansion. However, it introduces
the overhead of maintaining and accessing the index block.
• Operating systems like Unix and Linux use
indexed allocation for their file systems (e.g.,
ext2, ext3, ext4).
Examples
• Example: A file's index block might
contain pointers to blocks 2, 15, 8, and
30, indicating those blocks house
different parts of the file.
Now, let's consider the same storage
medium and file but using index allocation:

• Index Block for file.txt:


• |3|

| Block 7 | Block 12 | Block 5 |


|--------------------------------------|
• | file.txt |
• In this case:
• The index block (a single block) for "file.txt"
contains pointers to the actual data blocks.
• The index block points to Block 7, Block 12,
and Block 5, which are scattered on the
storage medium.
• This method allows for non-contiguous storage
of data blocks, reducing fragmentation.
• If another file is deleted, it won't affect the
ability to allocate space for a new file
efficiently.
• Additionally, if the file needs to be expanded,
new blocks can be added and updated in the
index block.
In this scheme, a special
block known as the Index
block contains the pointers
to all the blocks occupied by
a file. Each file has its own
index block.
Advantages

• Reduced Fragmentation: Index allocation reduces external


fragmentation as data blocks need not be stored contiguously. It
allows for more flexible use of available free space.
• File Expansion: Adding more blocks to a file is easier since they
don't have to be contiguous. The index block can be updated to
include additional pointers.
• Efficient Space Utilization: There is less wasted space compared
to contiguous allocation since blocks can be scattered across the
storage medium.
Disadvantages:
• Indirection Overhead: Accessing data may involve
additional indirection through the index block, which
can slightly increase access time.
• Complexity: Implementing and managing index
allocation is more complex than contiguous
allocation due to the need to maintain and update
index blocks.
• Potential for Fragmentation within Index Blocks:
While external fragmentation is reduced, there can
still be internal fragmentation within index blocks.
• File systems often use a combination of these
methods or other advanced techniques to
balance the advantages and disadvantages
based on the specific requirements and
characteristics of the system.
Linked List Allocation

• In this scheme, each file is a linked list of


disk blocks which need not be contiguous.
The disk blocks can be scattered anywhere
on the disk.
• The directory entry contains a pointer to
the starting and the ending file block. Each
block contains a pointer to the next block
occupied by the file.
The file ‘jeep’ in following image
shows how the blocks are
randomly distributed. The last
block (25) contains -1 indicating
a null pointer and does not point
to any other block
Free Space Management

• Free space management in computer


systems refers to the techniques used to
track and allocate unused disk space
efficiently.
• With constant file creation and deletion,
ensuring optimal utilization and preventing
wasted space is crucial for performance and
storage optimization.
• Free space management is a crucial aspect of file
systems, ensuring efficient utilization of storage
space and facilitating the allocation of space for
new files.
• A file system is responsible to allocate the free
blocks to the file therefore it has to keep track of
all the free blocks present in the disk. There are
mainly two approaches by using which, the free
blocks in the disk are managed.
Slide Title

Product A Product B
• Feature 1 • Feature 1
• Feature 2 • Feature 2
• Feature 3 • Feature 3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy