Virtual Memory in Operating System (original) (raw)

Last Updated : 15 Apr, 2026

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.

virtual_memory

Virtual Memory

How Virtual Memory Works

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,

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

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

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,

Applications of Virtual memory

Management of Virtual Memory

Here are 5 key points on how to manage virtual memory:

1. Adjust the Page File Size

2. Place the Page File on a Fast Drive

3. Monitor and Optimize Usage

4. **Keep Virtual Memory Enabled

5. Optimize System Settings

Benefits of Using Virtual Memory

Limitation of Virtual Memory

Read more about - Virtual Memory Questions

Virtual Memory vs Physical Memory

Feature Virtual Memory Physical Memory (RAM)
Definition An abstraction that extends the available memory by using disk storage The actual hardware (RAM) that stores data and instructions currently being used by the CPU
Location On the hard drive or SSD On the computer's motherboard
Speed Slower (due to disk I/O operations) Faster (accessed directly by the CPU)
Capacity Larger, limited by disk space Smaller, limited by the amount of RAM installed
Cost Lower (cost of additional disk storage) Higher (cost of RAM modules)
Data Access Indirect (via paging and swapping) Direct (CPU can access data directly)
Volatility Depends on storage (disk is non-volatile, but data is managed temporarily) Volatile (data is lost when power is off)