0% found this document useful (0 votes)
2 views61 pages

Virtual Memory in Operating System

Virtual memory is a memory management technique that allows operating systems to give the illusion of a large memory space by using both RAM and disk storage, enabling programs larger than physical memory to run efficiently. It involves methods like paging and segmentation, managed by the Memory Management Unit (MMU), which translates virtual addresses to physical addresses. While virtual memory enhances system performance and security, it can also lead to slower performance and increased complexity in memory management.

Uploaded by

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

Virtual Memory in Operating System

Virtual memory is a memory management technique that allows operating systems to give the illusion of a large memory space by using both RAM and disk storage, enabling programs larger than physical memory to run efficiently. It involves methods like paging and segmentation, managed by the Memory Management Unit (MMU), which translates virtual addresses to physical addresses. While virtual memory enhances system performance and security, it can also lead to slower performance and increased complexity in memory management.

Uploaded by

uucms nep
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Virtual Memory in Operating System

Virtual memory is a memory management technique used by operating systems to give the
appearance of a large, continuous block of memory to applications, even if the physical
memory (RAM) is limited and not necessarily allocated in contiguous manner.
 A program doesn’t need to be fully loaded in memory to run. Only the needed parts
are loaded.
 Programs can be bigger than the physical memory available in the system.
 Virtual memory creates the illusion of a large memory, even if the actual memory
(RAM) is small.
 It uses both RAM and disk storage to manage memory, loading only parts of
programs into RAM as needed.
 This allows the system to run more programs at once and manage memory more
efficiently.

How Virtual Memory Works

 Virtual memory uses both hardware and software to manage


memory.

 When a program runs, it uses virtual addresses (not real memory


locations).
 The computer system converts these virtual addresses into physical
addresses (actual locations in RAM) while the program runs.

Types of Virtual Memory


Virtual memory is managed by the Memory Management Unit (MMU), which is often built
into the CPU. The CPU generates virtual addresses that the MMU translates into physical
addresses. There are two main types of virtual memory:
1. Paging
2. Segmentation
1. Paging
Paging divides memory into small fixed-size blocks called pages. When the computer runs
out of RAM, pages that aren't currently in use are moved to the hard drive, into an area called
a swap file. Here,
 The swap file acts as an extension of RAM.
 When a page is needed again, it is swapped back into RAM, a process known as page
swapping.
 This ensures that the operating system (OS) and applications have enough memory to
run.
Page Fault Service Time: The time taken to service the page fault is called page fault
service time. The page fault service time includes the time taken to perform all the above
steps.
 Let Main memory access time is: m
 Page fault service time is: s
 Page fault rate is : p

 Then, Effective memory access time = ( p∗s)+(1− p)∗m

Page and Frame: Page is a fixed size block of data in virtual memory and a frame is a fixed
size block of physical memory in RAM where these pages are loaded.
 Think of a page as a piece of a puzzle (virtual memory) While, a frame as the spot
where it fits on the board (physical memory).
 When a program runs its pages are mapped to available frames so the program can
run even if the program size is larger than physical memory.
2. Segmentation
Segmentation divides virtual memory into segments of different sizes. Segments that aren't
currently needed can be moved to the hard drive. Here,
 The system uses a segment table to keep track of each segment's status, including
whether it's in memory, if it's been modified and its physical address.
 Segments are mapped into a process's address space only when needed.
Applications of Virtual memory
 Increased Effective Memory: It enables a computer to have more memory than the
physical memory using the disk space. This allows for the running of larger
applications.
 Memory Isolation: Virtual memory allocates a unique address space to each process,
such separation increases safety and reliability based on the fact that one process
cannot interact with another.
 Efficient Memory Management: Virtual memory also helps in better utilization of
the physical memories through methods that include paging and segmentation.
 Simplified Program Development: For case of programmers, they can program ‘as
if’ there is one big block of memory and this makes the programming easier and more
efficient in delivering more complex applications.
Management of Virtual Memory
Here are 5 key points on how to manage virtual memory:
1. Adjust the Page File Size
 Automatic Management: All contemporary OS including Windows contain the auto-
configuration option for the size of the empirical page file. But depending on the size
of the RAM, they are set automatically, although the user can manually adjust the
page file size if required.
 Manual Configuration: For tuned up users, the setting of the custom size can
sometimes boost up the performance of the system. The initial size is usually advised
to be set to the minimum value of 1.
2. Place the Page File on a Fast Drive
 SSD Placement: If this is feasible, the page file should be stored in the SSD instead
of the HDD as a storage device. It has better read and write times and the virtual
memory may prove beneficial in an SSD.
 Separate Drive: Regarding systems having multiple drives involved, the page file
needs to be placed on a different drive than the OS and that shall in turn improve its
performance.
3. Monitor and Optimize Usage
 Performance Monitoring: Employ the software tools used in monitoring the
performance of the system in tracking the amounts of virtual memory.
 Regular Maintenance: Make sure there is no toolbar or other application running in
the background, take time and uninstall all the tool bars to free virtual memory.
4. Keep Virtual Memory Enabled
 Even with large RAM (e.g., 16GB+), virtual memory should generally remain
enabled, as the OS relies on it for efficient memory management and system stability.
5. Optimize System Settings
 System Configuration: Change some general properties of the system concerning
virtual memory efficiency. This also involves enabling additional control options in
Windows.
 Regular Updates: Ensure that your drivers are run in their newest version because
new releases contain some enhancements and issues regarding memory management.
Benefits of Using Virtual Memory
 Supports Multiprogramming & Larger Programs : Virtual
memory allows multiple processes to reside in memory at once by using demand
paging. Even programs larger than physical memory can be executed efficiently.
 Maximizes Application Capacity : With virtual memory, systems can run more
applications simultaneously, including multiple large ones. It also allows only
portions of programs to be loaded at a time, improving speed and reducing memory
overhead.
 Eliminates Physical Memory Limitations : There's no immediate need to upgrade
RAM as virtual memory compensates using disk space.
 Boosts Security & Isolation : By isolating the memory space for each process,
virtual memory enhances system security. This prevents interference between
applications and reduces the risk of data corruption or unauthorized access.
 Improves CPU & System Performance: Virtual memory helps the CPU
by managing logical partitions and memory usage more effectively. It allows for cost-
effective, flexible resource allocation, keeping CPU workloads optimized and
ensuring smoother multitasking.
 Enhances Memory Management Efficiency : Virtual memory automates memory
allocation, including moving data between RAM and disk without user intervention. It
also avoids external fragmentation, using more of the available memory effectively
and simplifying OS-level memory management.
Limitation of Virtual Memory
 Slower Performance: Virtual memory can slow down the system, because it often
needs to move data between RAM and the hard drive.
 Risk of Data Loss: There is a higher risk of losing data if something goes wrong, like
a power failure or hard disk crash, while the system is moving data between RAM and
the disk.
 More Complex System: Managing virtual memory makes the operating system more
complex. It has to keep track of both real memory (RAM) and virtual memory and
make sure everything is in the right place.

Virtual Memory vs Physical Memory


Feature Virtual Memory Physical Memory (RAM)

An abstraction that extends The actual hardware (RAM) that


Definition the available memory by stores data and instructions
using disk storage currently being used by the CPU

Location On the hard drive or SSD On the computer's motherboard

Slower (due to disk I/O Faster (accessed directly by the


Speed
operations) CPU)

Larger, limited by disk Smaller, limited by the amount of


Capacity
space RAM installed

Lower (cost of additional


Cost Higher (cost of RAM modules)
disk storage)

Data Indirect (via paging and Direct (CPU can access data
Access swapping) directly)

Depends on storage (disk is


Volatile (data is lost when power
Volatility non-volatile, but data is
is off)
managed temporarily)

Demand Paging in Operating System


Demand paging is a technique used in virtual memory systems where
pages enter main memory only when requested or needed by the CPU. OS
loads only the necessary pages of a program into memory at runtime,
instead of loading the entire program into memory at the start. Here,

 A page fault occurred when the program needed to access a page


that is not currently in memory.

 The operating system then loads the required pages from the disk
into memory and updates the page tables accordingly.

 This process is transparent to the running program and it continues


to run as if the page had always been in memory.

Pure Demand Paging

Pure demand paging is a specific implementation of demand paging. In


on-demand paging only, no pages are initially loaded into memory when
the program starts and all pages are initially marked as being on disk.

 Operating systems that use pure demand paging as a memory


management strategy do so without preloading any pages into
physical memory prior to the commencement of a task.

 Demand paging loads a process's whole address space into memory


one step at a time, bringing just the parts of the process that are
actively being used into memory from disc as needed.

 It is useful for executing huge programs that might not fit totally in
memory or for computers with limited physical memory.

 If the program accesses a lot of pages that are not in memory right
now, it could also result in a rise in page faults and possible
performance overhead.

 Operating systems frequently use caching techniques and improve


page replacement algorithms to lessen the negative effects of page
faults on system performance as a whole.
Working Process of Demand Paging

Let us understand this with the help of an example. Suppose we want to


run a process P which have four pages P0, P1, P2 and P3. Currently, in the
page table, we have pages P1 and P3.

 Program Execution: Upon launching a program, the operating


system allocates a certain amount of memory to the program and
establishes a process for it.

 Creating Page Tables: To keep track of which program pages are


currently in memory and which are on disk, the operating system
makes page tables for each process.

 Handling Page Fault: When a program tries to access a page that


isn't in memory at the moment, a page fault happens. In order to
determine whether the necessary page is on disk, the operating
system pauses the application and consults the page tables.
 Page Fetch: The operating system loads the necessary page into memory by
retrieving it from the disk if it is there.

 The page's new location in memory is then reflected in the page table.

 Resuming The Program: The operating system picks up where it left off when
the necessary pages are loaded into memory.

 Page Replacement: If there is not enough free memory to hold all the pages a
program needs, the operating system may need to replace one or more pages
currently in memory with pages currently in memory. on the disk. The page
replacement algorithm used by the operating system determines which pages are
selected for replacement.
 Page Cleanup: When a process terminates, the operating system frees the
memory allocated to the process and cleans up the corresponding entries in the
page tables.

Page Replacement Algorithms in Operating Systems


In an operating system that uses paging, a page replacement algorithm is needed when a

page fault occurs and no free page frame is available. In this case, one of the existing

pages in memory must be replaced with the new page.

The virtual memory manager performs this by:

1. Selecting a victim page using a page replacement algorithm.

2. Marking its page table entry as “not present.”

3. If the page was modified (dirty), writing it back to disk before replacement.

The efficiency of a page replacement algorithm directly affects the page fault rate, which

in turn impacts system performance.

Common Page Replacement Techniques

 First In First Out (FIFO)

 Optimal Page replacement(OPR)

 Least Recently Used (LRU)

 Most Recently Used (MRU)

1. First In First Out (FIFO)

This is the simplest page replacement algorithm. In this algorithm, the operating system

keeps track of all pages in the memory in a queue, the oldest page is in the front of the

queue. When a page needs to be replaced page in the front of the queue is selected for

removal.

Example 1: Consider page reference string 1, 3, 0, 3, 5, 6, 3 with 3-page frames. Find the

number of page faults using FIFO Page Replacement Algorithm.


FIFO - Page Replacement

 Initially, all slots are empty, so when 1, 3, 0 came they are allocated to the empty slots

---> 3 Page Faults.

 When 3 comes, it is already in memory so ---> 0 Page Faults.

 Then 5 comes, it is not available in memory, so it replaces the oldest page slot i.e 1.

---> 1 Page Fault.

 6 comes, it is also not available in memory, so it replaces the oldest page slot i.e 3 --->

1 Page Fault.

 Finally, when 3 come it is not available, so it replaces 0 1-page fault.

2. Optimal Page Replacement

In this algorithm, pages are replaced which would not be used for the longest duration of time

in the future.

Example: Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3 with 4-page frame.

Find number of page fault using Optimal Page Replacement Algorithm.


Optimal Page Replacement

 Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots ---> 4

Page faults

 0 is already there so ---> 0 Page fault. when 3 came it will take the place of 7 because

it is not used for the longest duration of time in the future---> 1 Page fault.

 0 is already there so ---> 0 Page fault. 4 will takes place of 1 ---> 1 Page Fault.

Now for the further page reference string ---> 0 Page fault because they are already available

in the memory. Optimal page replacement is perfect, but not possible in practice as the

operating system cannot know future requests. The use of Optimal Page replacement is to set

up a benchmark so that other replacement algorithms can be analyzed against it.

3. Least Recently Used

In this algorithm, page will be replaced which is least recently used.

Example Consider the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3 with 4-page

frames. Find number of page faults using LRU Page Replacement Algorithm.
Least Recently Used - Page Replacement

 Initially, all frames are empty. When 1, 3, 0 arrive, they are placed in empty frames,

resulting in 3 page faults.

 When 3 arrives again, it is already present in memory, so there is no page fault.

 When 5 arrives, it is not in memory, so it replaces the oldest page (1), resulting in 1

page fault.

 When 6 arrives, it is not in memory, so it replaces the oldest page (3), resulting in 1

page fault.

 Finally, when 3 arrives, it is not in memory, so it replaces the oldest page (0), resulting

in 1 page fault.

Total Page Faults = 6

Program for Least Recently Used (LRU) Page Replacement algorithm

4. Most Recently Used (MRU)

In this algorithm, page will be replaced which has been used recently. Belady's anomaly can

occur in this algorithm.

Example 4: Consider the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3 with 4-page

frames. Find number of page faults using MRU Page Replacement Algorithm.
Most Recently Used - Page Replacement

 Initially, all frames are empty. When 7, 0, 1, 2 are loaded, there are 4 page faults.

 0 is already present in memory, so there is no page fault.

 When 3 arrives, it replaces 0 (most recently used), resulting in 1 page fault.

 When 0 arrives, it replaces 3 (most recently used), resulting in 1 page fault.

 When 4 arrives, it replaces 0 (most recently used), resulting in 1 page fault.

 2 is already present in memory, so there is no page fault.

 When 3 arrives, it replaces 2 (most recently used), resulting in 1 page fault.

 When 0 arrives, it replaces 3 (most recently used), resulting in 1 page fault.

 When 3 arrives, it replaces 0 (most recently used), resulting in 1 page fault.

 When 2 arrives, it replaces 3 (most recently used), resulting in 1 page fault.

 When 3 arrives, it replaces 2 (most recently used), resulting in 1 page fault.

Allocation of frames in Operating System


An important aspect of operating systems, virtual memory is implemented using demand

paging. Demand paging necessitates the development of a page-replacement algorithm and

a frame allocation algorithm. Frame allocation algorithms are used if you have multiple

processes; it helps decide how many frames to allocate to each process. There are various

constraints to the strategies for the allocation of frames:


 You cannot allocate more than the total number of available frames.

 At least a minimum number of frames should be allocated to each process. This

constraint is supported by two reasons. The first reason is, as less number of frames

are allocated, there is an increase in the page fault ratio, decreasing the performance

of the execution of the process. Secondly, there should be enough frames to hold all

the different pages that any single instruction can reference.

Frame allocation algorithms - The two algorithms commonly used to allocate frames to a

process are:

1. Equal allocation: In a system with x frames and y processes, each process gets equal

number of frames, i.e. x/y. For instance, if the system has 48 frames and 9 processes,

each process will get 5 frames. The three frames which are not allocated to any

process can be used as a free-frame buffer pool.

 Disadvantage: In systems with processes of varying sizes, it does not make

much sense to give each process equal frames. Allocation of a large number of

frames to a small process will eventually lead to the wastage of a large number

of allocated unused frames.

2. Proportional allocation: Frames are allocated to each process according to the process

size. For a process pi of size si, the number of allocated frames is ai = (si/S)*m, where

S is the sum of the sizes of all the processes and m is the number of frames in the

system. For instance, in a system with 62 frames, if there is a process of 10KB and

another process of 127KB, then the first process will be allocated (10/137)*62 = 4

frames and the other process will get (127/137)*62 = 57 frames.

 Advantage: All the processes share the available frames according to their

needs, rather than equally.


Global vs Local Allocation - The number of frames allocated to a process can also

dynamically change depending on whether you have used global replacement or local

replacement for replacing pages in case of a page fault.

1. Local replacement: When a process needs a page which is not in the memory, it can

bring in the new page and allocate it a frame from its own set of allocated frames

only.

 Advantage: The pages in memory for a particular process and the page fault

ratio is affected by the paging behavior of only that process.

 Disadvantage: A low priority process may hinder a high priority process by

not making its frames available to the high priority process.

2. Global replacement: When a process needs a page which is not in the memory, it can

bring in the new page and allocate it a frame from the set of all frames, even if that

frame is currently allocated to some other process; that is, one process can take a

frame from another.

 Advantage: Does not hinder the performance of processes and hence results in

greater system throughput.

 Disadvantage: The page fault ratio of a process can not be solely controlled by

the process itself. The pages in memory for a process depends on the paging

behavior of other processes as well.

Thrashing
Thrashing occurs when the operating system spends more time swapping pages between main

memory and disk than executing processes. This leads to excessive page faults and a

significant drop in CPU utilization.

The cycle works like this:


 High degree of multiprogramming: Too many processes are loaded into memory.

 Lack of frames: Each process gets fewer frames than needed.

 Page replacement policy: Frequent replacements increase page faults.

Storage Management:
Storage Management is defined as it refers to the management of the data storage

equipment's that are used to store the user/computer generated data. Hence it is a tool or set

of processes used by an administrator to keep your data and storage equipment’s safe. Storage

management is a process for users to optimize the use of storage devices and to protect the

integrity of data for any media on which it resides and the category of storage management

generally contain the different type of subcategories covering aspects such as security,

virtualization and more, as well as different types of provisioning or automation, which is

generally made up the entire storage management software market.

Storage management key attributes: Storage management has some key attribute which is

generally used to manage the storage capacity of the system. These are given below:

1. Performance

2. Reliability

3. Recoverability
4. Capacity

Feature of Storage management: There is some feature of storage management which is

provided for storage capacity. These are given below:

1. Storage management is a process that is used to optimize the use of storage devices.

2. Storage management must be allocated and managed as a resource in order to truly

benefit a corporation.

3. Storage management is generally a basic system component of information systems.

4. It is used to improve the performance of their data storage resources.

Advantage of storage management: There are some advantage of storage management which

are given below:

 It becomes very simple to manage a storage capacity.

 It generally reduces the time consumption.

 It improves the performance of system.

 In virtualization and automation technologies, it can help an organization improve its

agility.

Limitations of storage management:

 Limited physical storage capacity: Operating systems can only manage the physical

storage space that is available, and as such, there is a limit to how much data can be

stored.

 Performance degradation with increased storage utilization: As more data is stored,

the system's performance can decrease due to increased disk access time,

fragmentation, and other factors.

 Complexity of storage management: Storage management can be complex, especially

as the size of the storage environment grows.

 Cost: Storing large amounts of data can be expensive, and the cost of additional

storage capacity can add up quickly.


 Security issues: Storing sensitive data can also present security risks, and the

operating system must have robust security features in place to prevent unauthorized

access to this data.

 Backup and Recovery: Backup and recovery of data can also be challenging,

especially if the data is stored on multiple systems or devices.

Mass-Storage Structure

Introduction

Mass-storage structure refers to the storage devices used to store large amounts of data

permanently in a computer system. It is an important part of the operating system because

it provides secondary storage for programs and files.

Examples:

 Hard Disk

 SSD

 Optical Disk

 RAID

1. Disk Structure

Magnetic disks provide the bulk of secondary storage of modern computers.

Features

 Drives rotate at 60 to 200 times per second.

 Transfer rate is the speed at which data flows between drive and computer.

 Positioning time (random-access time) consists of:

o Seek time

o Rotational latency

Seek Time

Time taken to move disk arm to desired cylinder.


Rotational Latency

Time waiting for desired sector to rotate under disk head.

Head Crash

Occurs when disk head touches disk surface and damages data.

Platter

Platter is a circular magnetic disk surface where data is permanently stored in a hard disk.

Track

Track is a circular path present on the platter used to store data.

Sector

Sector is the smallest unit of storage on a disk where data is stored.

Cylinder

Cylinder is a collection of tracks located at the same position on different platters.

Read/Write Head
Read/Write head is the device that reads data from the disk and writes data onto the disk.

Spindle

Spindle is the central rod that rotates the platters at high speed.

Disk Arm

Disk arm is the mechanical arm that moves the read/write head to different tracks on the

disk.

Disk Scheduling Algorithms


Disk scheduling algorithms manage 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.

 Disk scheduling is also known as I/O Scheduling.

 The main goals of disk scheduling are to optimize the performance of disk operations,

reduce the time it takes to access data and improve overall system efficiency.

 Common disk scheduling methods include First-Come, First-Served (FCFS), Shortest

Seek Time First (SSTF), SCAN, C-SCAN, LOOK, and C-LOOK.

Importance of Disk Scheduling in Operating System

 Multiple I/O requests may arrive by different processes and only one I/O request can

be served at a time by the disk controller. Thus other I/O requests need to wait in the

waiting queue and need to be scheduled.

 Two or more requests may be far from each other so this can result in greater disk arm

movement.

 Hard drives are one of the slowest parts of the computer system and thus need to be

accessed in an efficient manner.

Characteristics of Disk Scheduling

 Seek Time: Time taken to move the disk arm to the track where data is located.
 Rotational Latency: Time taken for the desired sector to rotate under the read/write

head.

 Transfer Time: Time taken to actually read or write the data, depending on disk

speed and data size.

Disk Access Time = Seek Time + Rotational Latency + Transfer Time

Total Seek Time = Total head Movement * Seek Time

Disk Access Time and Disk Response Time

Disk Response Time

 Response Time: The time a request waits before its I/O operation starts.

 Average Response Time: The mean waiting time of all requests.

 Variance in Response Time: How much individual waiting times differ from the

average.

Goals of Disk Scheduling Algorithms

 Minimize Seek Time

 Maximize Throughput

 Minimize Latency

 Ensuring Fairness

 Efficiency in Resource Utilization

Disk Scheduling Algorithms

There are several Disk Several Algorithms. We will discuss in detail each one of them.

 FCFS (First Come First Serve)

 SSTF (Shortest Seek Time First)


 SCAN

 C-SCAN

 LOOK

 C-LOOK

1. FCFS (First Come First Serve)

FCFS (First Come First Serve) is the simplest disk scheduling algorithm where requests

are processed in the order they arrive in the queue. It is easy to implement but may lead to

higher seek time and lower efficiency.

 Processes requests in arrival order

 Simple and easy to implement

 No starvation of requests

 May result in high seek time and poor performance

Problem-

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14, 124, 65, 67. The
FCFS scheduling algorithm is used. The head is initially at cylinder number 53. The cylinders are
numbered from 0 to 199. The total head movement (in number of cylinders) incurred while servicing these
requests is _______.
Solution-

 Total head movements incurred while servicing these requests


 = (98 – 53) + (183 – 98) + (183 – 41) + (122 – 41) + (122 – 14) + (124 – 14) + (124 – 65)
+ (67 – 65)
 = 45 + 85 + 142 + 81 + 108 + 110 + 59 + 2
 = 632
 To gain better understanding about FCFS Disk Scheduling Algorithm,

First Come First Serve

Suppose the order of request is- (50,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

Here are some of the advantages of First Come First Serve.

 Every request gets a fair chance

 No indefinite postponement

Disadvantages of FCFS

Here are some of the disadvantages of First Come First Serve.

 Does not try to optimize seek time

 May not provide the best possible service

3. SSTF (Shortest Seek Time First)

 SSTF stands for Shortest Seek Time First.

 This algorithm services that request next which requires least number of head

movements from its current position regardless of the direction.

 It breaks the tie in the direction of head movement.

Advantages-

 It reduces the total seek time as compared to FCFS.

 It provides increased throughput.

 It provides less average response time and waiting time.

Disadvantages-

 There is an overhead of finding out the closest request.

 The requests which are far from the head might starve for the CPU.

 It provides high variance in response time and waiting time.

 Switching the direction of head frequently slows down the algorithm.


SSTF (Shortest Seek Time First) is a disk scheduling algorithm that selects the request

closest to the current disk arm position, minimizing seek time. It improves performance

compared to FCFS by reducing average response time and increasing system throughput.

 Selects the request with minimum seek time

 Executes requests closest to the disk head first

 Reduces average seek time and improves efficiency

 May cause starvation of distant requests

Example: Problem-01:

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122,

14, 124, 65, 67. The SSTF scheduling algorithm is used. The head is initially at

cylinder number 53 moving towards larger cylinder numbers on its servicing pass.

The cylinders are numbered from 0 to 199. The total head movement (in number of

cylinders) incurred while servicing these requests is _______.

Solution-
Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (67 – 41) + (41 – 14) + (98 – 14) + (122 – 98) + (124 – 122) +

(183 – 124)

= 12 + 2 + 26 + 27 + 84 + 24 + 2 + 59

= 236

Problem-02:

Consider a disk system with 100 cylinders. The requests to access the cylinders occur in

following sequence-

4, 34, 10, 7, 19, 73, 2, 15, 6, 20

Assuming that the head is currently at cylinder 50, what is the time taken to satisfy all

requests if it takes 1 ms to move from one cylinder to adjacent one and shortest seek time first

policy is used?

1. 95 ms

2. 119 ms

3. 233 ms

4. 276 ms
Solution-

Total head movements incurred while servicing these requests

= (50 – 34) + (34 – 20) + (20 – 19) + (19 – 15) + (15 – 10) + (10 – 7) + (7 – 6) + (6 – 4) +

(4 – 2) + (73 – 2)

= 16 + 14 + 1 + 4 + 5 + 3 + 1 + 2 + 2 + 71

= 119

Time taken for one head movement = 1 msec. So,

Time taken for 119 head movements

= 119 x 1 msec

= 119 msec

Thus, Option (B) is correct.


Shortest Seek Time First

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

Read/Write head is: 50

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 of Shortest Seek Time First

Here are some of the advantages of Shortest Seek Time First.

 The average Response Time decreases

 Throughput increases

Disadvantages of Shortest Seek Time First

Here are some of the disadvantages of Shortest Seek Time First.

 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

 The high variance of response time as SSTF favors only some requests
3. SCAN

The SCAN algorithm is a disk scheduling method where the disk arm moves in one

direction, servicing requests along the way, and then reverses direction at the end, similar

to an elevator. It provides better performance than simple algorithms but may cause

longer waiting time for some requests.

 Disk arm moves in one direction servicing requests

 Reverses direction after reaching the end

 Also known as the elevator algorithm

 Mid-range requests are served faster, others may wait longer

 Example:

SCAN Algorithm

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".

SCAN goes to disk end even if no request exists there

Therefore, the total overhead movement (total distance covered by the disk arm) is

calculated as
= (199-50) + (199-16) = 332

Problem-

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14,

124, 65, 67. The SCAN scheduling algorithm is used. The head is initially at cylinder

number 53 moving towards larger cylinder numbers on its servicing pass. The cylinders

are numbered from 0 to 199. The total head movement (in number of cylinders) incurred

while servicing these requests is _______.

Solution-

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (199 –

183) + (199 – 41) + (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 16 + 158 + 27

= 331

Alternatively,
Total head movements incurred while servicing these requests

= (199 – 53) + (199 – 14)

= 146 + 185

= 331

Advantages of SCAN Algorithm

Here are some of the advantages of the SCAN Algorithm.

 High throughput

 Low variance of response time

 Average response time

Disadvantages of SCAN Algorithm:

 Head may move to disk end unnecessarily

 High waiting time for some requests

 New requests may wait longer

Learn More in detail: SCAN

4. C-SCAN

C-SCAN (Circular SCAN) is an improvement over the SCAN algorithm where the disk

arm moves in one direction only. Instead of reversing, it jumps back to the beginning of

the disk and continues servicing requests, providing more uniform wait times.

 Disk arm moves in one direction only

 After reaching the end, it jumps to the beginning

 Services requests in a circular manner

 Provides more uniform waiting time compared to SCAN

Example:
Problem-

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14,

124, 65, 67. The C-SCAN scheduling algorithm is used. The head is initially at cylinder

number 53 moving towards larger cylinder numbers on its servicing pass. The cylinders

are numbered from 0 to 199. The total head movement (in number of cylinders) incurred

while servicing these requests is _______.

Solution-

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (199 –

183) + (199 – 0) + (14 – 0) + (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 16 + 199 + 14 + 27

= 386

Alternatively,
Total head movements incurred while servicing these requests

= (199 – 53) + (199 – 0) + (41 – 0)

= 146 + 199 + 41

= 386

To gain better understanding about C-SCAN Disk Scheduling Algorithm,

Circular SCAN

Problem-

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14,

124, 65, 67. The C-SCAN scheduling algorithm is used. The head is initially at cylinder

number 53 moving towards larger cylinder numbers on its servicing pass. The cylinders

are numbered from 0 to 199. The total head movement (in number of cylinders) incurred

while servicing these requests is _______.


Solution-

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (199 –

183) + (199 – 0) + (14 – 0) + (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 16 + 199 + 14 + 27

= 386

Alternatively,

Total head movements incurred while servicing these requests

= (199 – 53) + (199 – 0) + (41 – 0)

= 146 + 199 + 41

= 386
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

Advantages of C-SCAN Algorithm:

 Eliminates starvation of requests

 Better performance for heavy disk load

 More fair than SCAN algorithm

Learn more in detail: C-SCAN

Disadvantages of C-SCAN Algorithm:

 Extra head movement due to return to start

 Increased seek time compared to SCAN in light load

 More overhead because of circular movement

5. LOOK

LOOK is a disk scheduling algorithm similar to SCAN, but instead of moving the disk

arm to the end, it only goes up to the last pending request in that direction and then

reverses, reducing unnecessary movement.

 Moves disk arm only up to the last request, not the disk end

 Reverses direction after servicing the last request

 Avoids unnecessary disk traversal

 Improves efficiency and reduces seek time compared to SCAN

Example:

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14,

124, 65, 67. The LOOK scheduling algorithm is used. The head is initially at cylinder
number 53 moving towards larger cylinder numbers on its servicing pass. The cylinders

are numbered from 0 to 199. The total head movement (in number of cylinders) incurred

while servicing these requests is _______.

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (183 – 41)

+ (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 142 + 27

= 299

Alternatively,

Total head movements incurred while servicing these requests


= (183 – 53) + (183 – 14)

= 130 + 169

= 299

LOOK Algorithm

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

Advantages

 Reduced Unnecessary Movement: The disk arm only goes as far as the last request

in each direction, avoiding travel to the disk’s physical end (unlike SCAN).

 Faster Response: Less head movement leads to quicker service for requests.
Disadvantages of LOOK Algorithm:

 Waiting time can still be high for some requests

 Performance depends on request distribution

 Not completely fair to newly arrived requests

Learn more in detail: LOOK

6. C-LOOK

C-LOOK is similar to C-SCAN but avoids unnecessary movement by going only up to

the last request in one direction and then jumping to the last request at the other end,

instead of going to the disk’s extreme end.

 Moves only up to the last request in one direction

 Jumps to the last request at the other end

 Does not go to the physical disk end

 Reduces unnecessary movement and improves efficiency

Example: Consider a disk queue with requests for I/O to blocks on

cylinders 98, 183, 41, 122, 14, 124, 65, 67. The C-LOOK scheduling

algorithm is used. The head is initially at cylinder number 53 moving

towards larger cylinder numbers on its servicing pass. The cylinders are

numbered from 0 to 199. The total head movement (in number of

cylinders) incurred while servicing these requests is _______.


Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) +

(183 – 124) + (183 – 14) + (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 169 + 27

= 326

Alternatively,

Total head movements incurred while servicing these requests

= (183 – 53) + (183 – 14) + (41 – 14)

= 130 + 169 + 27

= 326
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"

C-LOOK

So, the total overhead movement (total distance covered by the disk arm) is calculated as

= (190-50) + (190-16) + (43-16) = 341

Advantages:

 Uniform Wait Time: Requests are serviced in a circular manner, so waiting times are

more predictable and fair.

 Reduced Head Movement: The arm only goes as far as the last request in one

direction, then jumps back, saving time compared to C-SCAN.

Disadvantages of C-LOOK Algorithm:

 Extra head movement due to circular scanning

 Increased seek time compared to LOOK under light load

 Newly arrived requests may have to wait for a full cycle


File Systems in Operating System
File systems are a crucial part of any operating system, providing a structured way to

store, organize and manage data on storage devices such as hard drives, SSDs and USB

drives.

File System

 User Application: The programs or software that request file operations like read,

write, or delete.

 Logical File System: Manages metadata, file names, directories, and access

permissions.

 Virtual File System (VFS): Acts as a bridge, allowing different file systems to work

under a single interface.

 Physical File System: Handles the actual storage of data blocks on the disk.

 Partition 1, Partition 2, Partition 3: Divisions of the storage device where files are

stored physically.
Note: It acts as a bridge between the operating system and the physical storage

hardware, allowing users and applications to perform CRUD Operations on files in an

organized and efficient manner.

Popular File Systems

Issues Handled By File System

 A free space is created on the hard drive whenever a file is deleted from it.

 To reallocate them to other files, many of these spaces may need to be recovered.

 A key issue is how to efficiently allocate disk blocks to files to optimize space and

performance.

File Directories

The collection of files is a file directory and contains information about the files,

including attributes, location, etc. Much of this information, is managed by the operating

system.

Note: The directory is itself a file, accessible by various file management routines.

File Types and Their Content


File Types & their Content
Note: It may be kept in the disk's non-contiguous blocks. We must keep track of all the

blocks where the files are partially located.

Advantages of Maintaining Directories

 Efficiency: A file can be located more quickly.

 Naming: It becomes convenient for users as two users can have same name for

different files or may have different name for same file.

 Grouping: Logical grouping of files can be done by properties e.g. all java programs,

all games etc.

Structures of Directory

 Single-Level Directory: In this, a single directory is maintained for all the users.

 Two-Level Directory: In this separate directories for each user is maintained.

 Tree-Structured Directory: The directory is maintained in the form of a tree.

Searching is efficient and also there is grouping capability. We have absolute or

relative path name for a file.

File Allocation Methods


There are several types of file allocation methods. These are mentioned below:

 Continuous Allocation

 Linked Allocation(Non-contiguous allocation)

 Indexed Allocation

Contiguous Allocation

In this scheme, each file occupies a contiguous set of blocks on the disk.
This means that given the starting block address and the length of the file
(in terms of blocks required), we can determine the blocks occupied by
the file. The directory entry for a file with contiguous allocation contains:
 Address of starting block

 Length of the allocated portion.

 Example: If a file requires n blocks and is given a block b as the


starting location, then the blocks assigned to the file will be:

b, b+1, b+2,......b+n-1.

Advantages

 Both the Sequential and Direct Accesses are supported by this. For direct access, the
address of the kth block of the file which starts at block b can easily be obtained
as ( b+ k ).

 This is extremely fast since the number of seeks are minimal because of contiguous
allocation of file blocks.
Disadvantages
 This method suffers from both internal and external fragmentation. This makes it
inefficient in terms of memory utilization.
 Increasing file size is difficult because it depends on the availability of contiguous
memory at a particular instance.
Linked Allocation
In this scheme, each file is a linked list of disk blocks which need not be contiguous. Here,
 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.

 Example: 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.

Advantages
 This is very flexible in terms of file size. File size can be increased easily since the
system does not have to look for a contiguous chunk of memory.
 This method does not suffer from external fragmentation. This makes it relatively
better in terms of memory utilization.
Disadvantages
 Because the file blocks are distributed randomly on the disk, a large number of seeks
are needed to access every block individually. This makes linked allocation slower.
 It does not support random or direct access. We can not directly access the blocks of a
file. A block k of a file can be accessed by traversing k blocks sequentially (sequential
access ) from the starting block of the file via block pointers.
 Pointers required in the linked allocation incur some extra overhead.
Indexed Allocation
In this scheme, a special block known as the Index block contains the pointers to all the
blocks occupied by a file. Here,
 Each file has its own index block.

 The ith entry in the index block contains the disk address of the i th file
block.

 The directory entry contains the address of the index block as shown in the image.

Advantages

 This supports direct access to the blocks occupied by the file and
therefore provides fast access to the file blocks.

 It overcomes the problem of external fragmentation.

Disadvantages

 The pointer overhead for indexed allocation is greater than linked


allocation.

 For very small files, say files that expand only 2-3 blocks, the
indexed allocation would keep one entire block (index block) for the
pointers which is inefficient in terms of memory utilization. However,
in linked allocation we lose the space of only 1 pointer per block.

File Access Methods in Operating System


File access methods are techniques used by an OS to read and write data in files. They

define how information is organized, retrieved, and modified. Choosing the right method

is important for performance and data management.

There are three ways to access a file in a computer system:

 Sequential-Access

 Direct Access

 Index sequential Method

Sequential Access

A file access method where data is read or written in order, one record after another,

starting from the beginning. The file pointer moves forward automatically after each

operation.
Sequential Access Method

Key Points related to Sequential Access

 Data is accessed from one record right after another record in an order.

 When we use the read command, it moves ahead pointer by one.

 When we use the write command, it will allocate memory and move the pointer to the

end of the file.

 Such a method is reasonable for tape.

Advantages of Sequential Access Method

 It is simple to implement this file access mechanism.

 Data is accessed sequentially in the order it is stored.

 It is less prone to data corruption as the data is written sequentially and not randomly.

Disadvantages of Sequential Access Method

 Slow for searching specific records.

 Inserting/updating in the middle is difficult.

 Can waste storage if records have varying lengths.

Direct Access Method


A file access method that allows data to be read or written directly at any block or record,

using its address (block number). It supports random access without scanning previous

records.

Advantages of Direct Access Method

 The files can be immediately accessed decreasing the average access time.

 In the direct access method, in order to access a block, there is no need of traversing

all the blocks present before it.

Disadvantages of Direct Access Method

 Complex Implementation : Implementing direct access can be complex, requiring

sophisticated algorithms and data structures to manage and locate records efficiently.

 Higher Storage Overhead : Direct access methods often require additional storage for

maintaining data location information (such as pointers or address tables), which can

increase the overall storage requirements.

Index Sequential method

It is the other method of accessing a file that is built on the top of the sequential access

method. These methods construct an index for the file. The index, like an index in the
back of a book, contains the pointer to the various blocks. To find a record in the file, we

first search the index, and then by the help of pointer we access the file directly.

Index Access Method

Key Points Related to Index Sequential Method

 It is built on top of Sequential access.

 It control the pointer by using index.

Advantages of Index Sequential Method

 Fast Searching: Index enables quick lookups.

 Flexible: Supports both sequential and random access.

 Reduced Access Time: Quickly locates data in large files.

Disadvantages of Index Sequential Method

 Complexity: Harder to implement and maintain than sequential access.

 Extra Storage: Requires additional space for indexes.

 Slower Updates: Both data and index must be updated during insertions, deletions, or

modifications.

 Maintenance Overhead: Indexes need frequent updates in dynamic environments.

Other Way of File Access

1. Relative Record Access

Relative record access is a file access method used in operating systems where records are

accessed relative to the current position of the file pointer. In this method, records are

located based on their position relative to the current record, rather than by a specific

address or key value.

Key Points Related to Relative Record Access

 Relative record access is a random access method that allows records to be accessed

based on their position relative to the current record.


 This method is efficient for accessing individual records but supports relative/random

access using record positions to specific records.

 Relative record access requires fixed-length records and may not be flexible enough

for some applications.

 This method is useful for processing records in a specific order or for files that are

accessed sequentially.

Advantages of Relative Record Access

 Random Access: Allows direct access to any record by moving the file pointer to a

specific offset.

 Efficient Retrieval: Faster than sequential access when accessing individual records

since only required records are read.

 Sequential Use: Useful for ordered processing (e.g., accessing next/previous records

in sorted files).

Disadvantages of Relative Record Access

 Fixed Record Length: Requires equal-sized records; padding may be needed.

 Low Flexibility: Hard to insert or delete records without disturbing others.

 Limited Use: Suitable for regular/sequential access, but less flexible due to fixed-

length records.

Structures of Directory in Operating System


The operating system uses directories to track where files are stored, just like using folders to
organise papers.
 Different directory structures can be used to suit various organisational needs.
 Understanding directory structures helps in organising and accessing files more easily.
By using these structures, it becomes simpler to manage and navigate files on your computer.
Different Types of Directories in OS
In an operating system, there are different types of directory structures that help organise and
manage files efficiently. Each type of directory has its own way of arranging files and
directories, offering unique benefits and features. These are
 Single-Level Directory
 Two-Level Directory
 Tree Structure/ Hierarchical Structure
 Acyclic Graph Structure
 General-Graph Directory 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.
 Since it is a single directory, so its implementation is very easy.
 If the files are smaller in size, searching will become faster.
 The operations like file creation, searching, deletion, updating are very easy in such a
directory structure.
Advantages
 Logical Organization: .Simple to implement and suitable for small systems.
 Efficiency: Faster file searching and access.
 Security: Restrict access at directory level to protect data.
 Backup & Recovery: Simplifies locating and restoring files.
 Scalability: Easily supports growth with new files and directories
Disadvantages
 There may chance of name collision because two files can have the same name.
 Searching will become time taking if the directory is large.
 This can not group the same type of files together.
2) Two-Level Directory
In a two-level directory structure, each user has a separate User File Directory (UFD)
containing only their files. A Master File Directory (MFD) stores entries for all users and
points to their respective UFDs, preventing filename conflicts between users.
Two-Levels Directory Structure
Advantages
 Different users can have files with the same name.
 A security would be there which would prevent user to access other user's files.
 Searching of the files becomes very easy in this directory structure.
Disadvantages
 File sharing is limited and less convenient between users.
 Unlike the advantage users can create their own files, users don't have the ability to
create subdirectories.
 Scalability is not possible because one user can't group the same types of files
together.
3) Tree Structure/ Hierarchical Structure
The tree directory structure is the most common in personal computers. It resembles an
upside-down tree, with the root directory at the top containing all user directories. Each user
can create files and subdirectories within their own directory but cannot access or modify the
root or other users’ directories.
Tree/Hierarchical Directory Structure
Advantages
 This directory structure allows subdirectories inside a directory.
 The searching is easier.
 It helps in organizing files by importance, making important files easier to locate.
 This directory is more scalable than the other two directory structures explained.
Disadvantages
 As the user isn't allowed to access other user's directory, this prevents the file sharing
among users.
 As the user has the capability to make subdirectories, if the number of subdirectories
increase the searching may become complicated.
 Users cannot modify the root directory data.
 Searching may become complex as the directory depth increases.
4) Acyclic Graph Structure
In the earlier directory structures, a file could only be accessed from the directory it was
stored in. The acyclic graph directory structure solves this by allowing a file or subdirectory
to be shared across multiple directories using links. Changes made by one user are visible to
all users sharing that file.
In the below figure, this explanation can be nicely observed, where a file is shared between
multiple users. If any user makes a change, it would be reflected to both the users.
Acyclic Graph Structure
Advantages
 Sharing of files and directories is allowed between multiple users.
 Searching becomes too easy.
 Flexibility is increased as file sharing and editing access is there for multiple users.
Disadvantages
 Because of the complex structure it has, it is difficult to implement this directory
structure.
 The user must be very cautious to edit or even deletion of file as the file is accessed
by multiple users.
 If we need to delete the file, then we need to delete all the references of the file
inorder to delete it permanently.
5) General-Graph Directory Structure
Unlike the acyclic-graph directory, which avoids loops, the general-graph directory can have
cycles, meaning a directory can contain paths that loop back to the starting point. This can
make navigating and managing files more complex.
General Graph Directory Structure
In the above image, you can see that a cycle is formed in the User 2 directory. While this
structure offers more flexibility, it is also more complicated to implement.
Advantages of General-Graph Directory
 More flexible than other directory structures.
 Allows cycles, meaning directories can loop back to each other.
Disadvantages of General-Graph Directory
 More expensive to implement compared to other solutions.
 Requires garbage collection to manage and clean up unused files and directories.

RAID (Redundant Arrays of Independent


Disks)
RAID Works
In RAID (Redundant Array of Independent Disks), data is not stored on just one hard drive
but is distributed across multiple drives.
 The data is split into small blocks (like dividing a file into chunks). These blocks are
written across multiple drives in parallel.
 Mirroring (RAID 1): Exact copy of data is kept on another drive.
 Parity (RAID 5, RAID 6): A calculated value (parity block) is stored to allow data
recovery in case of failure.
 Fault Tolerance: If one drive fails, RAID uses the redundant data (mirror or parity) to
reconstruct missing data.
Note: This improves performance by allowing multiple drives to read/write data
simultaneously.
RAID Controller
A RAID controller manages multiple hard drives, making them work together as one system.
It helps improve speed and adds data protection by handling drive failures. Think of it as a
smart manager that boosts performance and keeps your data safe.

RAID Controller
Types of RAID Controller
There are three types of RAID controller:
1. Hardware-Based:
Uses a dedicated physical controller to manage hard drives.
 Offers high speed and reliability
 Can work independently from the computer's processor
 Often built into the motherboard or as a separate card
 Think of it as a captain managing the drives smoothly.
2. Software-Based:
Uses the computer’s processor and memory to manage RAID.
 No special hardware needed
 Cost-effective, but may reduce overall system performance
 Slower than hardware RAID
 Acts like a helpful assistant, but shares the load with other tasks.
3. Firmware-Based (Fake RAID):
Built into the computer's BIOS/firmware and works during boot-up.
 Needs a driver after the OS loads
 Cheaper than hardware RAID, but still uses CPU resources
 Also known as hybrid RAID or fake RAID
 A startup helper that hands over the job to software once the system runs.
Data Redundancy
Data redundancy, although taking up extra space, adds to disk reliability. This means,
 That in case of disk failure, if the same data is also backed up onto another disk, we
can retrieve the data and go on with the operation.
 On the other hand, if the data is spread across multiple disks without the RAID
technique, the loss of a single disk can affect the entire data.
Key Evaluation Points for a RAID System
When evaluating a RAID system, the following critical aspects should be considered:
1. Reliability
Refers to the system's ability to tolerate disk faults and prevent data loss.
Example:
 RAID 0 offers no fault tolerance; if one disk fails all data is lost.
 RAID 5 can tolerate one disk failure due to parity data.
 RAID 6 can handle two simultaneous disk failures.
2. Availability
The fraction of time the RAID system is operational and available for use.
Example:
 RAID 1 (Mirroring) allows immediate data access even during a single disk failure.
 RAID 5 and 6 may degrade performance during a rebuild, but data remains available.
3. Performance
Measures how efficiently the RAID system handles data processing tasks. This includes:
 Response Time: How quickly the system responds to data requests.
 Throughput: The rate at which the system processes data (e.g., MB/s or IOPS).
Types of RAID Controller
There are three types of RAID controller:
1. Hardware-Based:
Uses a dedicated physical controller to manage hard drives.
 Offers high speed and reliability
 Can work independently from the computer's processor
 Often built into the motherboard or as a separate card
 Think of it as a captain managing the drives smoothly.
2. Software-Based:
Uses the computer’s processor and memory to manage RAID.
 No special hardware needed
 Cost-effective, but may reduce overall system performance
 Slower than hardware RAID
 Acts like a helpful assistant, but shares the load with other tasks.
3. Firmware-Based (Fake RAID):
Built into the computer's BIOS/firmware and works during boot-up.
 Needs a driver after the OS loads
 Cheaper than hardware RAID, but still uses CPU resources
 Also known as hybrid RAID or fake RAID
 A startup helper that hands over the job to software once the system runs.
Data Redundancy
Data redundancy, although taking up extra space, adds to disk reliability. This means,
 That in case of disk failure, if the same data is also backed up onto another disk, we
can retrieve the data and go on with the operation.
 On the other hand, if the data is spread across multiple disks without the RAID
technique, the loss of a single disk can affect the entire data.
Key Evaluation Points for a RAID System
When evaluating a RAID system, the following critical aspects should be considered:
1. Reliability
Refers to the system's ability to tolerate disk faults and prevent data loss.
Example:
 RAID 0 offers no fault tolerance; if one disk fails all data is lost.
 RAID 5 can tolerate one disk failure due to parity data.
 RAID 6 can handle two simultaneous disk failures.
2. Availability
The fraction of time the RAID system is operational and available for use.
Example:
 RAID 1 (Mirroring) allows immediate data access even during a single disk failure.
 RAID 5 and 6 may degrade performance during a rebuild, but data remains available.
3. Performance
Measures how efficiently the RAID system handles data processing tasks. This includes:
 Response Time: How quickly the system responds to data requests.
 Throughput: The rate at which the system processes data (e.g., MB/s or IOPS).
Key Factors:
 RAID levels affect performance differently:
 RAID 0 offers high throughput but no redundancy.
 RAID 1 improves read performance by serving data from either mirrored disk but
may not improve write performance significantly.
 RAID 5/6 introduces overhead for parity calculations, affecting write speeds.
 Workload type (e.g., sequential vs. random read/write operations).
Performance Trade-offs: Higher redundancy often comes at the cost of slower writes (due to
parity calculations).
4. Capacity
The amount of usable storage available to the user after accounting for redundancy
mechanisms. For a set of N disks, each with B blocks, the available capacity depends on the
RAID level:
 RAID 0: All N × B blocks are usable (no redundancy).
 RAID 1: Usable capacity is B (only one disk's capacity due to mirroring).

 RAID 5: Usable capacity is (N −1)× B (one disk's worth of capacity used for parity).

 RAID 6: Usable capacity is (N −2)× B (two disks’ worth used for parity).
Trade-offs: Higher redundancy (RAID 5/ 6) reduces available capacity compared to non-
redundant setups (RAID 0).

Different RAID Levels


 RAID-0 (Striping)
 RAID-1 (Mirroring)
 RAID-2 (Bit-Level Striping with Dedicated Parity)
 RAID-3 (Byte-Level Striping with Dedicated Parity)
 RAID-4 (Block-Level Striping with Dedicated Parity)
 RAID-5 (Block-Level Striping with Distributed Parity)
 RAID-6 (Block-Level Striping with two Parity Bits)

Assignment Questions
1. Explain file organization and Access mechanism.
2. What is directory structure?
3. Explain in detail about file allocation methods.
4. Write a note on file operations.
5. Explain RAID Structure.
6. Explain various disk scheduling algorithms.
7. Explain various page replacement algorithm with example.
8. What is dispatch latency.

You might also like