Virtual Memory - Virtual memory

Card Puncher Data Processing


A process reserve memory for its use by requesting an allocation from the operating system. The entire reserved memory footprint of a program is referred to as its Virtual Memory. See history

Each process has its own virtual memory, which grows when the process requests more memory from the operating system, and shrinks when the process relinquishes unused memory. You can think of virtual memory size as the memory amount that the process has requested (or allocated) from the operating system, including reservations for its code, stack, data, and memory pools (under program control).

When part of the virtually allocated memory actually needs to be used, it is loaded or mapped to the real, physical memory of the host and becomes resident.

Over time, the operating system may swap out some of a process’ resident memory, according to a least-recently-used algorithm, to make room for other code or data. Thus, a process’ resident memory size may fluctuate independently of its virtual memory size. In a properly sized host there is enough physical memory, and thus swapping is disabled and should not be observed.

Process Explorer Virtual Memory


Why virtual ?

The memory management subsystem is one of the most important parts of the operating system. Since the early days of computing, there has been a need for more memory than exists physically in a system.

In fact, there is really only one fact that system administrators should always keep in mind:

There is never enough RAM

Strategies have been developed to overcome this limitation and the most successful of these is virtual memory. Virtual memory is a way of combining RAM modules with slower storage (such as disk storage drives) to give the system the appearance of having more RAM modules than is actually installed.

Disk I/O speeds are about 10-100 times slower than memory. Disk I/O speeds will be very fast when data is store on filer disk arrays because such devices usually have a large amount of memory to cache data.

Virtual Memory

Virtual Memory Concept

Address Space

The address space is the number of unique addresses needed to hold both:

  • the application
  • and its data.

See Process - address space

Memory Management Unit

In order to implement virtual memory, it is necessary for the computer system to have special memory management hardware. This hardware is often known as an MMU (Memory Management Unit). Without an MMU, when the CPU accesses RAM, the actual RAM locations never change — memory address 123 is always the same physical location within RAM.


However, with an MMU, memory addresses go through a translation step prior to each memory access. This means that memory address 123 might be directed to physical address 82043 at one time, and physical address 20468 another time. As it turns out, the overhead of individually tracking the virtual to physical translations for billions of bytes of memory would be too great. Instead, the MMU divides RAM into pages which are contiguous sections of memory of a set size that are handled by the MMU as single entities.

Page table (virtual to physical addresses)

Virtual Memory - Page table (virtual to physical addresses)

Virtual Memory Benefits

Virtual memory does more than just make your computer's memory go further. The memory management subsystem provides:

  • Large Address Spaces with Swapping

The operating system makes the system appear as if it has a larger amount of memory than it actually has. The virtual memory can be many times larger than the physical memory in the system,

  • Protection with the virtual address space

Each process in the system has its own virtual address space. These virtual address spaces are completely separate from each other and so a process running one application cannot affect another. Also, the hardware virtual memory mechanisms allow areas of memory to be protected against writing. This protects code and data from being overwritten by rogue applications.

Protected Mode is the virtual memory protection ? : Modern operating systems run processes in “protected mode”. What this mean is that a process can only “see” its own memory. It cannot interfere with other processes – memory or with kernel memory (memory used by the OS). This is accomplished by mapping the offsets of the memory used by a process to real memory. This mapping is maintained by mapping tables. The whole process is managed behind the scenes by the OS. For example, a process may request the value at offset 5000, but the OS translates this to offset 134000 in real memory and retrieves the data from there. The results is that each process has its own addressing space which it can use as it likes.

  • Memory Mapping

Memory mapping is used to map image and data files into a processes address space. In memory mapping, the contents of a file are linked directly into the virtual address space of a process. Memory-mapped files: reading files as if they were fully loaded in memory and the OS performing reads behind the scene

  • Fair Physical Memory Allocation

The memory management subsystem allows each running process in the system a fair share of the physical memory of the system,

The ability for multiple processes to have access to the same memory. Modifications to this shared memory are immediately visible for all processes.


First offset

Memory begins at 0 (represented in WDM as 0000000000000000).

Memory First Offset

Memory mapping

You can view memory mappings by opening the device manager, clicking view, and then resources by type.

  • launch “devmgmt.msc”,
  • select Resources by Connection in the View Menu,
  • Expand the Memory node.

On my laptop, the primary consumer of mapped device memory is, unsurprisingly, the video card, which consumes 255MB.

Range Calculation:

  • Headecimal: E0000000-EFFFFFFF
  • ‭‭To decimal: 3758096384‬-‭4026531839‬
  • ‭Diff: 268435455‬ byte
  • ‭In Mb: 268435455/1024/1024 = 255 Mb

Documentation / Reference

Discover More
Card Puncher Data Processing
Data Manipulation - Translation Lookaside Buffer (TLB)

A translation lookaside buffer (TLB) is a cpu cache of the virtual memory concept that the memory management hardware uses to improve virtual address translation speed of (virtual-to-physical address...
Card Puncher Data Processing
Instruction - Addressing Mode (Operand Addressing)

An addressing mode specifies how to calculate the real memory address of an instruction operand The term addressing mode is itself subject to different interpretations: either memory address calculation...
Linux - Vmstat (Virtual memory statistics)

vmstat (Virtual Memory Stats) reports virtual memory statistics. It shows: how much virtual memory there is, how much is free and paging activity. Most important, you can observe page-ins and...
Linux - ulimit (shell ressource control)

the soft limit freely in the range of 0... the hard limit too, but can only decrease it. limits.conf“”
Hierachy Storage
Memory - (Primary|Main|Internal) Memory

Main memory is also known as: Primary storage internal memory (to distinguish from external memory, such as hard drives) often referred to simply as memory, is the only one directly accessible to...
Card Puncher Data Processing
Memory - Physical Address

in computer memory Same as ?? OSvirtual address When storing and retrieving data from memory, an offset is used to determine the location in which the data is stored. This is fixed-length sequences...
Card Puncher Data Processing
Memory - Physical Address Space (Physical Memory)

The physical address space is the total number of uniquely-addressable physical address (memory locations) at a physical level (ie in the ram) and not logical (ie virtual) This is the total processor’s...
Cpu Memory Management Segmented Model
Memory - Segment

A memory segment is the division structure of the segmented memory model. The physical address spec (physical memory) of the primary memory is divide by segment. See virtual memoryvirtual segment ...
Card Puncher Data Processing
OS - Virtual Memory

OS This section is the implement of memory by the OS called the virtual memory, a layer of memory management above physical memory Conceptually speaking, there are only three types of memory: Kernel...
Process States
Process - Resident Memory

Resident memory is the part of the process memory that corresponds to the physical memory actually in operational use by this process. Over time, the operating system may swap out some of a process's...

Share this page:
Follow us:
Task Runner