You are on page 1of 2

Virtual Memory

Introduction
Virtual memory is a memory management technique that allows a computer to use more
memory than is physically installed. This is done by dividing the logical address space of a
process into smaller units called pages. The operating system then maps these pages to
physical memory as needed.

How Virtual Memory Works


When a process is first created, it is allocated a logical address space that is larger than the
physical memory available. The operating system then maps the pages of this logical address
space to physical memory as needed. If there is not enough physical memory available to
map all of the pages, the operating system will swap some of the pages out to disk.
When a process needs to access a page that is not currently in physical memory, a page fault
occurs. The operating system then brings the page into physical memory from disk and
remaps the page to the logical address space of the process.
Advantages of Virtual Memory
There are several advantages to using virtual memory:
• It allows a computer to use more memory than is physically installed.
• It allows the operating system to manage memory more efficiently.
• It allows multiple processes to share the same physical memory.
Disadvantages of Virtual Memory
There are also some disadvantages to using virtual memory:
• It can slow down the performance of a system, especially if the disk is slow.
• It can increase the complexity of the operating system.
Conclusion
Virtual memory is a powerful memory management technique that can be used to improve
the performance and efficiency of a computer system. However, it is important to be aware of
the potential disadvantages of virtual memory before using it.
Page Table
The operating system uses a page table to map logical addresses to physical addresses. The
page table is a data structure that is stored in memory. It contains an entry for each page in the
logical address space of a process. The entry in the page table contains the physical address of
the page and other information, such as the state of the page (e.g., whether the page is in
memory or on disk).
Page Fault
A page fault occurs when a process tries to access a page that is not currently in physical
memory. When a page fault occurs, the operating system brings the page into physical
memory from disk and remaps the page to the logical address space of the process.
Swapping
Swapping is a technique that is used to move pages from memory to disk. Swapping is used
when there is not enough physical memory available to map all of the pages of a process.
When a page is swapped out, it is moved to disk and the entry in the page table is updated to
reflect the new location of the page.
Summary
Virtual memory is a powerful memory management technique that can be used to improve
the performance and efficiency of a computer system. It is important to be aware of the
potential disadvantages of virtual memory before using it.

You might also like