Virtual Memory

Gabriel Abdul
2 min readJul 9, 2021

Most PCs come standard with RAM — or Random-access Memory, which gives programs a place to store and quickly retrieve data and is essentially the computer’s short term memory. Virtual memory is something every program has, and utilizes the computers RAM and other storage in a creative way.

Introduction to Virtual Memory

Virtual memory is essentially a mapping system that maps virtual addresses to physical address spaces that uses portions of the RAM to do so. Virtual memory is sometimes used to swap data that hasnt been accessed or used by the RAM in a while to store it in a more long term storage solution (the Disk, SSD/HDD, etc…) to be recalled later when necessary.

Each process has its own memory map, also known as a memory management unit (MMU). The memory map contains the directive for where the virtual memory will be mapped on the physical memory. While the process might think it has a certain contiguous space of memory the memory map actually uses different areas of the RAM to form the virtual memory that the process will use.

This system may seem odd, however certain areas of the RAM may already be reserved for other processes so it is necessary to find small and large areas of space all over the RAM to construct the virtual memory. Each process only has access to its reserved memory, if you try to access a region of memory that you do not have permission to, or in other words is not on your memory map, you will segfault.

The main drawback of using virtual memory is that it is considerably more slower than physical memory because of mapping that is required.

--

--