0% found this document useful (0 votes)
57 views

Virtual Memory

Virtual memory is a memory management technique that allows computers to use secondary storage like hard disks as an extension of physical memory. It divides memory into pages and uses techniques like demand paging to store unused pages on disk, freeing up physical memory. When processes need pages not in RAM, the OS swaps pages in and out using algorithms like LRU. Virtual memory provides benefits like increased memory capacity, memory isolation, improved multitasking and system stability. However, it also introduces overhead from page faults and potential thrashing if too many pages are swapped.

Uploaded by

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

Virtual Memory

Virtual memory is a memory management technique that allows computers to use secondary storage like hard disks as an extension of physical memory. It divides memory into pages and uses techniques like demand paging to store unused pages on disk, freeing up physical memory. When processes need pages not in RAM, the OS swaps pages in and out using algorithms like LRU. Virtual memory provides benefits like increased memory capacity, memory isolation, improved multitasking and system stability. However, it also introduces overhead from page faults and potential thrashing if too many pages are swapped.

Uploaded by

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

Learning Objectives

By the end of this presentation, you will:

1 Understand the concept of 2 Learn how virtual memory 3 Explore the benefits and
virtual memory works drawbacks of virtual memory

4 Discover common uses and applications of virtual 5 Gain insights into virtual memory management
memory techniques
What is Virtual Memory?
Virtual memory is a memory management technique that allows a computer to use secondary storage as
an extension of the primary memory. It means it allows a computer to compensate for limited physical
memory by creating the illusion of a larger memory space.

Virtual memory is also a key memory management technique in computer systems. It allows the
operating system to provide each process with its own virtual address space, separate from physical
memory. By using a combination of hardware and software mechanisms, virtual memory enables
efficient memory allocation, paging, and page replacement, ensuring optimal utilization of system
resources.
How does virtual memory work?
Memory Allocation Paging Page Replacement
Virtual memory divides the Unused pages are stored in When a process needs a page that
memory or virtual address secondary storage, such as the is not in physical memory, the
space into fixed-sized blocks, hard disk, freeing up physical operating system swaps out a less
called pages. memory for other processes. frequently used page and brings
in the required page.
Virtual Memory Management Techniques

Page Replacement Paging and Segmentation Virtual Memory Mapping


Algorithms
Different algorithms, such as Memory management Translation mechanisms map
FIFO, LRU, and Clock, are techniques like paging and virtual addresses to physical
used to determine which pages segmentation divide the virtual addresses, allowing efficient
to replace when memory is full. address space into smaller units data access and memory
for efficient memory allocation. protection.
Types of Virtual Memory
There are two major types of virtual memory. They are
1. Paging
2. Segmentation

Paging: It is a virtual memory technique that separate memory into sections called paging
file. When a computer reaches it’s RAM limit, it transfer all currently unused files into the
part of it’s hard drive.
This process is called swap file, a designated space in the hard drive for extending the
virtual memory of the computer’s RAM.
Segmentation: Segmentation is another method of managing virtual memory. It divides the
virtual memory into segments of different lengths and moves any segments that aren’t in use
from the computer virtual memory to it’s hard drive.

Segmentation differs from paging because it divides memory into sections of varying length
while paging divides memory into units of equal size and segmentation is slower than paging.
Benefits of Virtual Memory
1 Increased Memory Capacity
Virtual memory allows processes to use more memory than is physically available, improving system
performance.

2 Memory Isolation
Each process has its own virtual address space, preventing interference from other processes.

3 Enhanced Multitasking
Virtual memory enables simultaneous execution of multiple processes, improving overall system efficiency.

4 Improved system stability


Virtual memory helps prevent crashes and system instability by allowing the operating system to handle
memory shortages and prioritize memory usage efficiently.
5 Flexibility
Virtual machines can be easily provisioned, modified, and migrated, providing flexibility in managing and scaling
applications. This allows for quick deployment of new services and efficient resource allocation.
Limitations of Virtual Memory
1 Performance Overhead
refers to the additional processing time due to page table lookups and data transfers
between main memory and secondary storage.

2 Potential Thrashing
when the system spends more time managing memory than executing programs. This
shouldn’t be much a surprise if you consider the lengthy amount of processes that the
computer has to go through just to
3 Fault Handling
Page faults are errors that occur whenever a process requests for a page that is
currently not available in the physical memory, this actually limits the computer
in several ways, because the computer has to go and fetch that data from the
external storage, it would have to first make use of algorithms such as the least
recently used and the first in first out to determine which of the pages will be
swapped out of the physical memory. Handling page faults can consume
significant processing resources and may impact real-time systems, and also has
to make of a data structure known as the page table which is actually responsible
for the mapping between the physical memory and the virtual meory. Th
Functions of Virtual Memory
1 Address Translation: Translates virtual addresses used by a program into physical addresses corresponding
to locations in physical memory. This translation is typically done through a data structure called a page
table.

2 Demand Paging: Only loads pages into physical memory when they are demanded by a running program.
This reduces the initial loading time and conserves physical memory.

3 Page Fault Handling: Manages page faults, which occur when a program attempts to access a page not
currently in physical memory. The operating system responds by bringing the required page into RAM
from storage.

4 Memory Protection: Ensures that processes cannot access each other's memory spaces, preventing
unintended interference. Memory protection mechanisms help prevent unauthorized access and enhance
system stability.

5 Swap Space Management: Manages the storage space on disk used for swapping out pages when physical
memory becomes scarce. Efficient swap space management is crucial for performance.
Common Uses and Applications
1 Operating Systems
Virtual memory is a fundamental component of modern operating systems, allowing them to
efficiently manage memory resources.

2 Database Systems
Database management systems utilize virtual memory to handle large data sets and optimize
data access
3 Virtual Machines
Virtualization technologies rely on virtual memory to enable multiple virtual machines to run
simultaneously on a single physical machine.
Differences between Virtual Memory and Physical Memory
Feature Virtual Memory Physical Memory
Extended memory space provided
Actual hardware memory, typically
Definition by the OS by using secondary
RAM.
storage (e.g., disk).

Can be larger than physical Limited by the hardware, usually


Size memory. smaller.
Slower access time due to
Access Time potential page faults and disk I/O.
Faster access time as it is in RAM.

Operating System (OS) manages


Managed by virtual memory.
Hardware manages physical memory.

Offers flexibility for managing Limited flexibility compared to virtual


Flexibility memory resources efficiently. memory.
Enables the execution of larger
Directly used for program execution
Use Cases programs and efficient
and data storage.
multitasking.
Conclusion
Virtual memory is a technique used by modern operating systems to extend the available
memory of a computer beyond its physical limits. It allows multiple programs to run
concurrently, provides memory protection, and enables efficient use of memory. Virtual
memory management techniques such as demand paging and pre-paging further enhance
system performance and efficiency. While virtual memory has its drawbacks, it remains a
critical component of modern computing systems and is essential for running large,
complex programs.

You might also like