0% found this document useful (0 votes)
29 views20 pages

FILE CONCEPT For Second Internels

The document provides an overview of file systems, detailing the structure, types of files, and the processes involved in file management, including creation, reading, and deletion. It discusses directory structures, allocation methods, free space management, fragmentation, and performance metrics essential for evaluating file system efficiency. Additionally, it covers data recovery processes, including instance and crash recovery, highlighting the importance of maintaining data integrity and system performance.

Uploaded by

maneyacx
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)
29 views20 pages

FILE CONCEPT For Second Internels

The document provides an overview of file systems, detailing the structure, types of files, and the processes involved in file management, including creation, reading, and deletion. It discusses directory structures, allocation methods, free space management, fragmentation, and performance metrics essential for evaluating file system efficiency. Additionally, it covers data recovery processes, including instance and crash recovery, highlighting the importance of maintaining data integrity and system performance.

Uploaded by

maneyacx
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/ 20

FILE CONCEPT

FILE:
A file is a named collection of related information that is recorded on secondary
storage. The information in a file is defined by its creator. Many different types of
information may be stored in a file source programs, object programs, executable programs,
numeric data, text, payroll records, graphic images, sound recordings, and so on.
A file has a certain defined which depends on its type.
• A text file is a sequence of characters organized into lines.
• A source file is a sequence of subroutines and functions, each of which is further organized
as declarations followed by executable statements.
• An object file is a sequence of bytes organized into blocks understandable by the system's
linker.
• An executable file is a series of code sections that the loader can bring into memory and
execute.

DESIGN CHOICES / FILE SYSTEM STRUCTURE

1. APPLICATION PROGRAM:- This is the top most layer where users interact
with files through application. It provide the user interface for file operation like
creating, deleting, reading and writing etc. Example include text editors and file
browsers.
2. LOGICAL FILE SYSTEM:- It manages the metadata information about a file
i.e includes all details about a file except the actual contents of the file.

3. FILE – ORGANIZATION MODULE:- It has information about files, the


location of files and their logical and physical blocks. Physical blocks do not match
with logical numbers of logical blocks numbered from 0 to N.

4. BASIC FILE SYSTEM:- It issues general commands to the devices driver to


read and write physical blocks and disk.

5. INPUT/OUTPUT CONTROL LEVEL:- Device drivers act as an interface


between devices and OS, they help to transfer data between disk and main memory.

6. DEVICES:- The bottom most layer, consisting of the actual hardware devices. It
perform the actual reading and writing of data to the physical storage medium.

Practical implementation in file system


1. CREATING A FILE:- Two steps are necessary to create a file, first space in the file
system must be found for the file. Second, an entry for the new file.
2. WRITING A FILE:- To write a file, we make a system call specifying both the
name of the file and the information to be written to the file.
3. READING A FILE:- To read from a file, we use a system call that specifies the
name of the files and where (in memory) the next block of the file should be put.
4. REPOSITIONING WITHIN A FILE:- The directory Is searched for the
appropriate entry, and the current file – position pointer is repositioned to a given
value.
5. DELETING A FILE:- To delete a file. We search the directory for the named file
and erase the directory file.
6. TRUNCATING A FILE:- the user may want to erase the contents of a file but keep
its attributes.

ROLE OF META DATA IN FILE SYSTEM


Meta data provides essential information about files and other objects within
file system is known as role of meta data in file system.

a) FILE IDENTIFICATION:-
i. File name:- The name of the file is part of its meta data and is used to identify and
access the file.
ii. File type:- Meta data includes information about the type of file to ensure proper
handling and access by appropriate applications.
b) FILE ATTRIBUTES:-
i. Size:- The size of the file (in bites) is stored in the metadata and is used to allocate
space and manage file storage
ii. Permissions:- Information about who can read, write or execute the file. This is
essential for security and access control.

c) LOCATION AND ALLOCATION:-


i. Data block references:- Meta data holds information about the physical location of
the files data blocks. This enables the file system to quickly locate the file data on the
disk.
ii. File system block structure:- Information on how the file system allocates disk
blocks.

d) FILE INTEGRITY AND RECOVERY:-


i. Checksums/Hashes:- Some file system store checksums on hash value as part of the
meta data.
ii. Back up and recovery:- Meta data can be used to recover files in the event of a
crash or file system.

Directory structure
Directories are mainly used in organising the files. A directory isa collection
of files. The directories are used to store the files and attributes of the files too.

 Types of directory structure


1. Single level directory:-
In a single-level directory structure, there is only
one directory shared by all users. All files created by
users are stored directly in this single directory, without
any subdirectories.

Advantages:
 Simple to implement.
 Faster file access.
 Disadvantages:
 Naming problem.
 Grouping problem.

2. Two level directory:-


In the two-level directory structure, each user has its own user file directory (UFD).
The UFDs have similar structures, but each lists only the files of a single user.
When a user refers to a particular file, only his own UFD is searched. Different users may
have files with the same name, as long as all the file names within each UFD are unique.

Advantages:
Can have same file name for different
user efficient searching.

Disadvantages:
Grouping problem.
Poor file organization.

3. Tree Structured Directories


A tree is the most common directory structure.
• The tree has a root directory, and every file in the system has a unique path name.
• A directory contains a set of files or subdirectories. A directory is simply another file, but it
is treated in a special way.

4. Acyclic Graph Directories


Used to share files among different directories.An acyclic graph is a graph with no cycles.
It allows directories to share subdirectories and files. The same file or subdirectory may be in
two different directories. The acyclic graph is a natural generalization of the tree-structured
directory scheme.

ALLOCATION METHODS
Allocation methods address the problem of allocating space to files so that disk space
is utilized effectively and files can be accessed quickly.
Three methods exist for allocating disk space
• Contiguous allocation
• Linked allocation
• Indexed allocation

a) Contiguous Allocation:-
In Contiguous Allocation, a file's data is stored in a sequence of consecutive blocks
on the storage medium. This means all the data blocks for the file are located next to each
other on the disk without gaps. The starting block and the length (number of blocks) are
recorded in the file's metadata.
Advantages:-
 Faster access
 Simple and efficient for small files.
Disadvantages-
 Fragmentation
 Wastage of Space
 Limited scalability for large and dynamic systems.

b) Linked Allocation:-
In Linked Allocation, a file is divided into multiple blocks that can be scattered
across the disk. Each block stores the data along with a pointer to the next block of the
file. This eliminates the need for the file to occupy contiguous space.

Advantages:
 No Contiguous Space Needed
 Dynamic File Size
 Efficient Space Utilization

Disadvantages:
 Slower Access
 Pointer Overhead
 Risk of Broken Links

c) Indexed Allocation

In Indexed Allocation, a special block (called the index block) is used to store pointers to
all the data blocks of a file. Instead of linking blocks together (as in linked allocation), all
pointers to a file's blocks are collected in one place: the index block. This approach allows the
file's blocks to be scattered anywhere on the disk, while still supporting both sequential and
random access efficiently.

Advantages:
 No Fragmentation Issues
 Efficient Access
 Supports Dynamic File Size
 Simplified Management

Disadvantages:
 Overhead of the Index Block
 Limited File Size
 Extra Access for Index Block
 Complex Implementation

Free Space Management in Operating Systems


Free space management refers to the process of tracking and organizing the unused
blocks or areas on a storage device, such as a hard drive or SSD, so that new data can be
written efficiently. The OS maintains a record of free blocks to allocate them to files and
directories as needed.
Four Techniques of Free Space Management
 Bit Vector
 Free list
 Grouping
 Counting
1. Bit Vector
Bit vector method. Also known as the bit map, this is the most frequently used
method to implement the free space list. In this method, each block in the hard disk is
represented by a bit (either 0 or 1). If a block has a bit 0 means that the block is allocated
to a file, and if a block has a bit 1 means that the block is not allocated to any file, i.e., the
block is free.

2. Free list
In this method, all the free blocks existing in the disk are linked together in a linked
list. The address of the first free block is stored somewhere in the memory. Each free
block contains a pointer that contains the address to the next free block. The last free
block points to null, indicating the end of the linked list.
3. Grouping
The grouping technique is also called the "modification of a linked list technique”. In
this method, first, the free block of memory contains the addresses of the n-free blocks.
And the last free block of these n free blocks contains the addresses of the next n free
block of memory and this keeps going on. This technique separates the empty and
occupied blocks of space of memory.

4. Counting
This method takes advantage of the fact that several contiguous blocks may be
allocated or freed simultaneously. In this method, a linked list is maintained but in
addition to the pointer to the next free block, a count of free contiguous blocks that
follow the first block is also maintained. Thus each free block in the disk will contain
two things . A pointe to the next free block. The number of free contiguous blocks
following it
Comparison of Free Space Management Techniques
Feature Bit Map Linked List Grouping Counting
Structure Bit for each List of free Groups Count of
block blocks multiple blocks consecutive
blocks
Efficiency Fast for small Fast for small Efficient for Very efficient
spaces spaces large spaces for large block
Space Low, but High due to Low for large Minimal, just
Overhead grows with pointers groups the count
size
Fragmentation Can cause Low Reduces Minimizes
internal fragmentation fragmentation fragmentation
fragmentation
Complexity Simple to Moderate More complex Simple but
implement complexity needs
management
Access Time Constant time Linear search Faster for Constant time
groups for large
blocks
Fragmentation

Fragmentation occurs when the available storage space in a system is divided into
smaller, non-contiguous blocks, causing inefficiency in file storage. This issue can negatively
impact system performance, making it harder to allocate or access large files effectively.

Fragmentation is categorized into two main types: Internal Fragmentation and External
Fragmentation.

1. Internal Fragmentation: Internal fragmentation occurs when the allocated storage


blocks contain unused space that cannot be utilized. This usually happens because the size
of the allocated block is larger than the size of the data stored within it.
Ex: In database systems, where each row is allocated a fixed-size block, some rows may
leave unused space, resulting in wasted memory.
2. External Fragmentation: External fragmentation occurs when free blocks of memory
are scattered across the storage system, making it challenging to allocate large,
contiguous blocks of space for files or processes. Even if the total free space is sufficient,
the lack of contiguous blocks can lead to allocation failures.
Ex: In file systems, when a large file is stored in fragments across non-contiguous
blocks, performance may degrade as the system takes longer to read and write the file.

Difference between internal and external


Internal Fragmentation External Fragmentation
Inside the blocks that are already allocated. In the free space between allocated blocks.
The block size is bigger than the file or Free space is scattered, making it hard to
data stored in it. store large files.
Wasted space inside blocks. Hard to find large continuous space for
files.
A 3 KB file is stored in a 4 KB block, 4 MB of free space exists but is split into
wasting 1 KB inside. small chunks (e.g., 1 MB each), so a 3 MB
file can’t fit.

Compaction is not needed as memory Often requires compaction to merge free


waste is internal. space into contiguous blocks.
Reduces effective memory utilization. Affects system performance by slowing
down large file allocation.
Smaller block sizes or variable-sized Bitmaps, compaction, and grouping
blocks. techniques.
EFFICIENCY AND PERFORMANCE IN OS

Measuring the performance of a file system is essential to evaluate its efficiency,


reliability, and ability to handle workloads. File systems are responsible for managing how
data is stored, retrieved, and organized on storage devices, and their performance directly
impacts the overall speed and responsiveness of a system.

key metrics used to evaluate performance:

 Throughput: The amount of data that can be read or written per unit of time.
 Latency: The time it takes for a read or write operation to complete.
 IOPS (Input/Output Operations Per Second): The number of read and write
requests that can be processed per second.
 Response Time: The time it takes for a request to be processed and a response to
be returned.

Factors Affecting Efficiency and Ways to Improve It


Several factors can affect file system efficiency and performance:

1.Hardware:
 Disk Speed: Faster disks (e.g., SSDs) can significantly improve performance.
 Disk Controller: A high-performance disk controller can optimize data transfer
rates.
 Memory: More memory can reduce disk I/O and improve overall system
performance.
2. Software:
 File System Type: Different file systems have different performance
characteristics. Choosing the right file system for your workload is important.
 File System Configuration: Proper configuration of file system parameters,
such as block size and journal size, can impact performance.
 Kernel Settings: Kernel parameters related to I/O scheduling and caching
can affect file system performance.
 I/O Pattern: The pattern of I/O requests (sequential, random, small, large)
can significantly impact performance.
 Concurrency: The number of concurrent I/O requests can affect performance,
especially in high-load environments.

Techniques and Strategies to Improve File System Performance


Here are some techniques and strategies to improve file system performance:
 Use SSDs: Solid-state drives offer significantly better performance than traditional
hard disk drives.
 Optimize File System Configuration: Configure file system parameters
appropriately to match your workload.
 Tune Kernel Parameters: Adjust kernel parameters related to I/O scheduling and
caching to optimize performance.
 Use RAID: RAID can improve performance, fault tolerance, and data redundancy.
Optimize I/O Patterns: Try to organize data and access patterns to minimize
random I/O and maximize sequential I/O.
 Consider Compression: Compressing files can reduce disk space usage and
improve performance in some cases.
 Monitor and Analyse Performance: Use performance monitoring tools to
identify bottlenecks and optimize performance.
By carefully considering these factors and implementing appropriate techniques, you
can significantly improve the efficiency and performance of your file system.

DATA RECOVERY
Data recovery is the process of restoring data that has been lost, accidentally
deleted corrupted or made inaccessible
There are three basic types of recovery
 Instance recovery
 Crash recovery
 Media recovery

INSTANCE RECOVERY
Is a process used to restore the consistency of a system after a failure, such as
a crash, unexpected shutdown, or hardware failure
1.Failure Detection :The system identifies that an instance(e.g.(DBMS)database or
virtual machine) has failed or crashed.
2. Checkpoint/Log Replay: The system uses saved check points or logstore store the
instance to a consistent state.
3. Consistency Checks: The system performs integrity checks to ensure data
consistency across all structures (e.g., database tables, filesystems)

CRASH RECOVERY
Crash recovery in an operating system refers to the process of restoring the system to
a consistent and operational state after a crash or failure, such as a power failure, hardware
failure, or software bug.
Types of Failures
 System Crash: Occurs when the operating system halts due to a software bug or
system-level error.
 Hardware Failure: Includes issues such as disk failure or memory corruption.
 Power Failure: Results in abrupt shutdown, potentially leaving processes
incomplete.

Media Recovery
Media recovery refers to the process of restoring a system or database after a
failure that involves permanent damage to the storage medium, such as a disk
corruption or data loss.
Media Recovery Process
Failure Identification: The system detects damage to the storage medium
Data Restoration: Media recovery uses backups and archived logs to rebuild or
replace the damaged parts of the storage.
Log Replay: Just like in instance recovery, logs are replayed to restore data
consistency. This ensures that all transactions completed after the last backup are
recovered.
Consistency Checks: Integrity checks are performed to verify that the recovered data
is consistent and matches the intended structure

Methods for recovery in crashes


Reboot: Restarting your computer may fix the issue
Safe mode: Boot into safe mode to troubleshoot software issues
System restore: Use the built-in System Restore to recover from a crash
Backup: Restore from a recent backup if one is available
Recovery disc: Boot from a recovery disc, which is an external device that contains a self-running
operating system
Recovery: Scan the drive or folder to find deleted entries, define a files
Check Recycle Bin: Trash or use recovery software like Recuva for permanently deleted files. Run
File System Checks

File system consistency


Refers to the process of maintaining the integrity and reliability of the file system’s data
structures to ensure the system operates correctly. When a file system performs operations such as
writing, deleting, or modifying data, it updates metadata structures like nodes, file allocation tables,
and directory entries. Inconsistencies can occur due to unexpected interruptions like power failures,
system crashes, or hardware mal functions, leading to potential data corruption or loss.
File System Consistency Checker (FSCK)
FSCK: is one approach still used by older Linux-based systems to find and repair in consistency It is
not a complete solution and may still have inodes pointing to garbage data. The major focus is to
make the metadata internally consistent.
Bitmaps: Each sector has a bit that indicates whether the block is in use. Bitmaps are compact and
can be stored in memory.
Linked lists: Each free block contains a pointer to the next free block.
Missing blocks: A block that is never referenced is added to the free list.
Duplicate blocks: A duplicate block in the free list is rebuilt.
Duplicate data blocks: The checker copies the contents of the duplicate block to a free block, and
inserts it into one of the files.

Journaling and logging


These Are mechanisms used in file systems to maintain consistency and recover ability by
tracking changes. Though related, they have distinct purposes and implementation Journaling and
logging are mechanisms used in file systems to maintain consistency and recoverability by tracking
changes.
Purpose: Journaling focuses on system recovery, while logging provides ahistorical record of events
Scope: Journaling ensures transactional integrity of operations; logging may not necessarily impact
file system.
Recovery Location: journals are tightly integrated with file systems, whereas logs can exist
independently (e.g., log files in /var/log in Linux).Both are critical for maintaining file system
reliability and diagnosing issues effectively.
Logging: generally refers to recording system or application activities for tracking and debugging
purposes. In the context of file systems, it overlaps with journaling. but may also capture events such
as access history, system crashes, or other operational records. Logs are not always used for direct
recovery but are vital for auditing, identifying errors, and troubleshooting.

RECOVERY MECHANISMS IN FILE SYSTEM


Refers to the set of techniques and algorithms designed to detect, resolve, or mitigate
deadlock situations.

 Deadlock resolution: When a deadlock is detected, a recovery scheme can be used to restore
system functionality. This can involve
 Process termination: Terminating one or more processes involved in the deadlock
 Rollback: Rolling back the state of certain processes to a point where deadlock is not present
 Resource: This is the process of protecting these resources through protocols and program
interfaces.

Ensuring data integrity and fault tolerance


Data integrity and fault tolerance Are crucial for maintaining a reliable file system that can
withstand failures and ensure that data remains accurate and consistent. These concepts are closely
related but focus on different aspects of system

 Data Integrity: Data integrity ensures that the data stored in the file system remains accurate,
consistent, and unaltered except by authorized operations. Any corruption, whether caused by
software bugs, power failures, or hardware malfunctions, can lead to data loss or inconsistencies.
How it's ensured: Checksums and Hashing: File systems often use checksums or cryptographic
hashes to verify data during read and write operations. These checks can detect corruption in stored
data.
Fault Tolerance: Fault tolerance refers to the file system’s ability to continue operating correctly
despite the occurrence of hardware or software failures. A fault-tolerant system can handle failures
without losing data or requiring a complete shutdown.

 Redundancy: Techniques like RAID (Redundant Array of Independent Disks) or data mirroring
provide redundancy, ensuring that if one disk fails, the system can continue operating using a backup
copy of the data. Snapshots and Backups: Regular snapshots and backups create restore points,
enabling data recovery in case of corruption or loss. File systems like ZFS and Btrfs allow for
snapshot-based recovery.
Mass Storage Structure
• Systems designed to store enormous volumes of data are referred to as mass storage
devices.
• Magnetic disk provides a bulk of secondary storage of modern computers.
• Drives rotates at 60 to 250 times per second & Typical transfer rate is 100-150 M
Bytes/sec
• Positioning time i.e. typically, time is the time to move the disk arm to desired seek
time & time for desired sector to rotate the disk head (latency) i.e. it refers to the sum
of seek time plus rotational latency; typically, 5-10ms.
• Head crash results from disk head making contact with disk surface which is bad.
Disks can be removable

Structure of Mass Storage Devices


Mass storage devices typically consist of one or more platters or disks,
read/write heads, and a motor to spin the disks. The structure of a mass storage
device, such as a hard disk, includes:
• Platters: These are disks covered with magnetic media that spin to store data. Hard
disk platters are made of metal, while floppy disks are made of plastic.
• Working surfaces: Each platter has two working surfaces.
• Tracks: Each working surface is divided into concentric rings called tracks.
• Sectors: Each track is divided into sectors, which typically contain 512 bytes of data.
• Read-write heads: These read the data on the hard drive.
• Master Boot Record (MBR): This is the first sector on the hard drive and contains a
small amount of code and the partition table. The partition table indicates which
partition is the active or boot partition.

Advantages:
 Cost-Effectiveness
 Portability
 Better storage security
 Easier to manage
Dis-advantages:
 Size and weight
 Power consumption:
 Noise
 Sensitivity to physical damage

Impact of Mass Storage Devices on Data Access


 Improved latency
Advancements in mass storage technologies, such as SSDs, have significantly reduced data
access latency, enabling faster response times for applications and users.

 Increased Throughput

The higher data transfer rates of modern mass storage devices have increased
the overall throughput of data access, improving the performance of data-
intensive applications i.e. current devices can achieve transfer speeds of several
gigabytes per second, dramatically accelerating data operations.
 Enhanced Parallel Access
Modern mass storage supports advanced parallel access capabilities, allowing multiple read
and write operations to occur simultaneously. This parallelism significantly improves overall
system performance, especially in multi-user environments and high-load scenarios.
 Enhanced Reliability
Improved data integrity and fault-tolerance features of mass storage devices ensure the
reliability of stored information.
 Improved Capacity
The growing storage capacities of mass storage devices enable the efficient management and
archiving of large data sets.

Types of Mass Storage Devices


 Hard Disk Drives (HDDs)
HDDs use magnetic disks to store data, with moving mechanical parts to access the data.
They offer large capacity and relatively low cost.

 Solid-State Drives (SSDs


SSDs use flash memory to store data, with no moving parts. They provide faster data access
and higher reliability compared to HDDs.

 Optical Discs
Optical storage, such as CDs, DVDs, and Blu-ray discs, uses laser technology to read and
write data, offering portable and relatively inexpensive storage.

Disk Scheduling
Disk scheduling is a technique operating systems use to manage the order in which
disk I/O (input/output) requests are processed. Disk scheduling is also known as I/O
Scheduling.
Disk Scheduling Algorithms
Disk scheduling algorithms are crucial in managing how data is read from and
written to a computer’s hard disk. These algorithms help determine the order in which disk
read and write requests are processed, significantly impacting the speed and efficiency of
data access.
Key algorithms include First-Come, First-Served (FCFS), which processes requests in arrival
order but can lead to high seek times; Shortest Seek Time First (SSTF), which prioritizes
requests closest to the current head position to reduce seek time but risks starvation; SCAN
(Elevator Algorithm) and its variation C-SCAN, which sweep across the disk in one or both
directions, providing a balanced approach; and LOOK/C-LOOK, which optimize SCAN by
only traveling as far as the last request. Modern trends in disk scheduling, like real-time
scheduling and algorithms for SSDs, address unique challenges posed by evolving storage
technologies, focusing on workload efficiency and fairness.

Key Terms Associated with Disk Scheduling


 Seek Time: Seek time is the time taken to locate the disk arm to a specified track
where the data is to be read or written.
 Rotational Latency: Rotational Latency is the time taken by the desired sector of
the disk to rotate into a position so that it can access the read/write heads.
 Transfer Time: It is the time taken to transfer the data.
 Disk Access Time:
Disk Access Time = Seek Time + Rotational Latency + Transfer Time
 Disk Response Time: It is the average of time spent by each request waiting for the
IO operation.

Different types of Scans


1. FCFS (First Come First Serve)
It is the simplest Disk Scheduling algorithm. It services the IO requests in the order in which
they arrive. There is no starvation in this algorithm, every request is serviced.
Example:

Suppose the order of request is- (82,170,43,140,24,16,190)


And current position of Read/Write head is: 50
So, total overhead movement (total distance covered by the disk arm) =
(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16) =642

Advantages of FCFS
 Every request gets a fair chance
 No indefinite postponement

Disadvantages of FCFS
 Does not try to optimize seek time
 May not provide the best possible service

2. SSTF (Shortest Seek Time First)


In SSTF (Shortest Seek Time First), requests having the shortest seek time are
executed first. So, the seek time of every request is calculated in advance in the queue and
then they are scheduled according to their calculated seek time. As a result, the request near
the disk arm will get executed first.
Example:
Suppose the order of request is- (82,170,43,140,24,16,190)
And current position of Read/Write head is: 50
So,
total overhead movement (total distance covered by the disk arm) =
(50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-140)+(190-170) =208

Advantages
 The average Response Time decreases
 Throughput increases

Disadvantages
 Overhead to calculate seek time in advance
 Can cause Starvation for a request if it has a higher seek time as compared to
incoming requests

3. SCAN
It is also called as Elevator Algorithm. In this algorithm, the disk arm moves into a
particular direction till the end, satisfying all the requests coming in its path, and then it turns
back and moves in the reverse direction satisfying requests coming in its path. It works in the
way an elevator works, elevator moves in a direction completely till the last floor of that
direction and then turns back.
Example:

Suppose the requests to be addressed are- 82,170,43,140,24,16,190. And the


Read/Write arm is at 50, and it is also given that the disk arm should move “towards the
larger value”.
Therefore, the total overhead movement (total distance covered by the disk arm) is
calculated as
= (199-50) + (199-16) = 332

Advantages
 High throughput
 Low variance of response time
 Average response time

Disadvantages
 Long waiting time for requests for locations just visited by disk arm

4. C-SCAN
In the C-SCAN algorithm in which the disk arm instead of reversing its direction
goes to the other end of the disk and starts servicing the requests from there. So, the disk
arm moves in a circular fashion and this algorithm is also similar to the SCAN algorithm
hence it is known as C-SCAN (Circular SCAN).
Example:
Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the
Read/Write arm is at 50, and it is also given that the disk arm should move “towards the
larger value”.
So, the total overhead movement (total distance covered by the disk arm) is calculated as:
= (199-50) + (199-0) + (43-0) = 391

5. LOOK
LOOK Algorithm is similar to the SCAN disk scheduling algorithm except for the
difference that the disk arm in spite of going to the end of the disk goes only to the last
request to be serviced in front of the head and then reverses its direction from there only.
Thus it prevents the extra delay which occurred due to unnecessary traversal to the end of
the disk

Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the


Read/Write arm is at 50, and it is also given that the disk arm should move “towards the
larger value”.
So, the total overhead movement (total distance covered by the disk arm) is calculated as:
= (190-50) + (190-16) = 314

You might also like