- Virtual Address Space (Memory Management)
- Default Virtual Address Space for 32-bit Windows
- Virtual Address Space for 32-bit Windows with 4GT
- Adjusting the Virtual Address Space for 32-bit Windows
- How to Increase Virtual Memory in Windows 10: A Quick Guide
- Virtual Memory Functions
- Virtual address spaces
- User space and system space
- Paged pool and Nonpaged pool
- Виртуальное адресное пространство (управление памятью)
- Виртуальное адресное пространство по умолчанию для 32-разрядной версии Windows
- Виртуальное адресное пространство для 32-разрядной версии Windows с 4GT
- Настройка виртуального адресного пространства для 32-разрядной версии Windows
Virtual Address Space (Memory Management)
The virtual address space for a process is the set of virtual memory addresses that it can use. The address space for each process is private and cannot be accessed by other processes unless it is shared.
A virtual address does not represent the actual physical location of an object in memory; instead, the system maintains a page table for each process, which is an internal data structure used to translate virtual addresses into their corresponding physical addresses. Each time a thread references an address, the system translates the virtual address to a physical address.
The virtual address space for 32-bit Windows is 4 gigabytes (GB) in size and divided into two partitions: one for use by the process and the other reserved for use by the system. For more information about the virtual address space in 64-bit Windows, see Virtual Address Space in 64-bit Windows.
For more information about virtual memory, see the following topics:
Default Virtual Address Space for 32-bit Windows
The following table shows the default memory range for each partition.
Memory range | Usage |
---|---|
Low 2GB (0x00000000 through 0x7FFFFFFF) | Used by the process. |
High 2GB (0x80000000 through 0xFFFFFFFF) | Used by the system. |
Virtual Address Space for 32-bit Windows with 4GT
If 4-gigabyte tuning (4GT) is enabled, the memory range for each partition is as follows.
Memory range | Usage |
---|---|
Low 3GB (0x00000000 through 0xBFFFFFFF) | Used by the process. |
High 1GB (0xC0000000 through 0xFFFFFFFF) | Used by the system. |
After 4GT is enabled, a process that has the IMAGE_FILE_LARGE_ADDRESS_AWARE flag set in its image header will have access to the additional 1 GB of memory above the low 2 GB.
Adjusting the Virtual Address Space for 32-bit Windows
You can use the following command to set a boot entry option that configures the size of the partition that is available for use by the process to a value between 2048 (2 GB) and 3072 (3 GB):
BCDEdit /set increaseuserva Megabytes
After the boot entry option is set, the memory range for each partition is as follows.
How to Increase Virtual Memory in Windows 10: A Quick Guide
What is Virtual Memory?
In computing, virtual memory is a memory management technique that provides an «idealized abstraction of the storage resources that are actually available on a given machine» which «creates the illusion to users of a very large memory.» The computer’s operating system, using a combination of hardware and software, maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory.
Step 1: Go to Start Menu and click on Settings.
Step 2: Now type performance on search bar and select Adjust the appearance and performance of Windows.
Step 3: A new Window will open before you. Go to Advanced tab in it.
Step 4: You’ll see a Virtual memory section in it. Click on Change
Step 5: If the current setting is considerably less than the recommended, unselect the Automatically manage paging file size for all drives box on this window and click on Custom size.
Step 6: Now enter the recommended value in the Initial Size box, and a larger figure in the Maximum size
Step 7: Click on OK to save the changes.
Virtual Memory Functions
The virtual memory functions enable a process to manipulate or determine the status of pages in its virtual address space. They can perform the following operations:
- Reserve a range of a process’s virtual address space. Reserving address space does not allocate any physical storage, but it prevents other allocation operations from using the specified range. It does not affect the virtual address spaces of other processes. Reserving pages prevents needless consumption of physical storage, while enabling a process to reserve a range of its address space into which a dynamic data structure can grow. The process can allocate physical storage for this space, as needed.
- Commit a range of reserved pages in a process’s virtual address space so that physical storage (either in RAM or on disk) is accessible only to the allocating process.
- Specify read/write, read-only, or no access for a range of committed pages. This differs from the standard allocation functions that always allocate pages with read/write access.
- Free a range of reserved pages, making the range of virtual addresses available for subsequent allocation operations by the calling process.
- Decommit a range of committed pages, releasing their physical storage and making it available for subsequent allocation by any process.
- Lock one or more pages of committed memory into physical memory (RAM) so that the system cannot swap the pages out to the paging file.
- Obtain information about a range of pages in the virtual address space of the calling process or a specified process.
- Change the access protection for a specified range of committed pages in the virtual address space of the calling process or a specified process.
For more information, see the following topics.
Virtual address spaces
When a processor reads or writes to a memory location, it uses a virtual address. As part of the read or write operation, the processor translates the virtual address to a physical address. Accessing memory through a virtual address has these advantages:
A program can use a contiguous range of virtual addresses to access a large memory buffer that is not contiguous in physical memory.
A program can use a range of virtual addresses to access a memory buffer that is larger than the available physical memory. As the supply of physical memory becomes small, the memory manager saves pages of physical memory (typically 4 kilobytes in size) to a disk file. Pages of data or code are moved between physical memory and the disk as needed.
The virtual addresses used by different processes are isolated from each other. The code in one process cannot alter the physical memory that is being used by another process or the operating system.
The range of virtual addresses that is available to a process is called the virtual address space for the process. Each user-mode process has its own private virtual address space. For a 32-bit process, the virtual address space is usually the 2-gigabyte range 0x00000000 through 0x7FFFFFFF. For a 64-bit process on 64-bit Windows, virtual address space is the 128-terabyte range 0x000’00000000 through 0x7FFF’FFFFFFFF. A range of virtual addresses is sometimes called a range of virtual memory. For more info, see Memory and Address Space Limits.
This diagram illustrates some of the key features of virtual address spaces.
The diagram shows the virtual address spaces for two 64-bit processes: Notepad.exe and MyApp.exe. Each process has its own virtual address space that goes from 0x000’0000000 through 0x7FF’FFFFFFFF. Each shaded block represents one page (4 kilobytes in size) of virtual or physical memory. Notice that the Notepad process uses three contiguous pages of virtual addresses, starting at 0x7F7’93950000. But those three contiguous pages of virtual addresses are mapped to noncontiguous pages in physical memory. Also notice that both processes use a page of virtual memory beginning at 0x7F7’93950000, but those virtual pages are mapped to different pages of physical memory.
User space and system space
Processes like Notepad.exe and MyApp.exe run in user mode. Core operating system components and many drivers run in the more privileged kernel mode. For more information about processor modes, see User mode and kernel mode. Each user-mode process has its own private virtual address space, but all code that runs in kernel mode shares a single virtual address space called system space. The virtual address space for a user-mode process is called user space.
In 32-bit Windows, the total available virtual address space is 2^32 bytes (4 gigabytes). Usually the lower 2 gigabytes are used for user space, and the upper 2 gigabytes are used for system space.
In 32-bit Windows, you have the option of specifying (at boot time) that more than 2 gigabytes are available for user space. The consequence is that fewer virtual addresses are available for system space. You can increase the size of user space to as much as 3 gigabytes, in which case only 1 gigabyte is available for system space. To increase the size of user space, use BCDEdit /set increaseuserva.
In 64-bit Windows, the theoretical amount of virtual address space is 2^64 bytes (16 exabytes), but only a small portion of the 16-exabyte range is actually used.
Code running in user mode has access to user space but does not have access to system space. This restriction prevents user-mode code from reading or altering protected operating system data structures. Code running in kernel mode has access to both user space and system space. That is, code running in kernel mode has access to system space and the virtual address space of the current user-mode process.
Drivers that run in kernel mode must be very careful about directly reading from or writing to addresses in user space. This scenario illustrates why.
A user-mode program initiates a request to read some data from a device. The program supplies the starting address of a buffer to receive the data.
A device driver routine, running in kernel mode, starts the read operation and returns control to its caller.
Later the device interrupts whatever thread is currently running to say that the read operation is complete. The interrupt is handled by kernel-mode driver routines running on this arbitrary thread, which belongs to an arbitrary process.
At this point, the driver must not write the data to the starting address that the user-mode program supplied in Step 1. This address is in the virtual address space of the process that initiated the request, which is most likely not the same as the current process.
Paged pool and Nonpaged pool
In user space, all physical memory pages can be paged out to a disk file as needed. In system space, some physical pages can be paged out and others cannot. System space has two regions for dynamically allocating memory: paged pool and nonpaged pool.
Memory that is allocated in paged pool can be paged out to a disk file as needed. Memory that is allocated in nonpaged pool can never be paged out to a disk file.
Виртуальное адресное пространство (управление памятью)
Виртуальным адресным пространством для процесса является набор адресов виртуальной памяти, который можно использовать. Адресное пространство для каждого процесса является закрытым и не может быть доступно другим процессам, если он не является общим.
Виртуальный адрес не представляет фактическое физическое расположение объекта в памяти; Вместо этого система ведет таблицу страниц для каждого процесса, который представляет собой внутреннюю структуру данных, используемую для преобразования виртуальных адресов в соответствующие физические адреса. Каждый раз, когда поток ссылается на адрес, система преобразует виртуальный адрес в физический адрес.
Виртуальное адресное пространство для 32-разрядной версии Windows имеет размер 4 гигабайта (ГБ) и делится на две секции: одна для использования процессом, а другая зарезервирована для использования системой. Дополнительные сведения о пространстве виртуальных адресов в 64-разрядных Windows см. в разделе виртуальное адресное пространство в 64-разрядной версии Windows.
Дополнительные сведения о виртуальной памяти см. в следующих разделах:
Виртуальное адресное пространство по умолчанию для 32-разрядной версии Windows
В следующей таблице показан диапазон памяти по умолчанию для каждой секции.
Диапазон памяти | Использование |
---|---|
Низкая 2 ГБ (от 0x00000000 до 0x7FFFFFFF) | Используется процессом. |
Высокий 2 ГБ (от 0x80000000 до 0xFFFFFFFF) | Используется системой. |
Виртуальное адресное пространство для 32-разрядной версии Windows с 4GT
Если включена Настройка 4 гигабайта (4GT), диапазон памяти для каждой секции выглядит следующим образом.
Диапазон памяти | Использование |
---|---|
С низким 3 ГБ (0x00000000 до 0xBFFFFFFF) | Используется процессом. |
Высокий 1 ГБ (0xC0000000 до 0xFFFFFFFF) | Используется системой. |
После включения 4GT процесс, имеющий установленный в заголовке изображения флаг с большим количеством _ файлов _ _ _ изображений , будет иметь доступ к дополнительному объему памяти (1 ГБ), превышающему младшие 2 ГБ.
Настройка виртуального адресного пространства для 32-разрядной версии Windows
Можно использовать следующую команду, чтобы задать параметр записи загрузки, который настраивает размер раздела, который может использоваться процессом, в диапазоне от 2048 (2 ГБ) до 3072 (3 ГБ):
BCDEdit/Set инкреасеусерва мегабайт
После установки параметра загрузочной записи диапазон памяти для каждой секции выглядит следующим образом.