Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Virtual address space

From Wikipedia, the free encyclopedia
Set of ranges of virtual addresses
"Virtual address" and "virtual addressing" redirect here. For other uses, seeVirtual address (disambiguation).
This articlerelies largely or entirely on asingle source. Relevant discussion may be found on thetalk page. Please helpimprove this article byintroducing citations to additional sources.
Find sources: "Virtual address space" – news ·newspapers ·books ·scholar ·JSTOR
(August 2012)

Incomputing, avirtual address space (VAS) oraddress space is the set of ranges of virtual addresses that anoperating system makes available to a process.[1] The range of virtual addresses usually starts at a low address and can extend to the highest address allowed by the computer'sinstruction set architecture and supported by theoperating system's pointer size implementation, which can be 4bytes for32-bit or 8bytes for64-bit OS versions. This provides several benefits, one of which is security throughprocess isolation assuming each process is given a separateaddress space.

Example

[edit]
In the following description, the terminology used will be particular to theWindows NT operating system, but the concepts are applicable to othervirtual memory operating systems.

When a new application on a32-bit OS is executed, the process has a4GiB VAS: each one of thememory addresses (from 0 to 232 − 1) in that space can have a single byte as a value. Initially, none of them have values ('-' represents no value). Using or setting values in such a VAS would cause amemory exception.

           0                                           4 GiBVAS        |----------------------------------------------|

Then the application's executable file is mapped into the VAS. Addresses in the process VAS are mapped to bytes in the exe file. The OS manages the mapping:

           0                                           4 GiBVAS        |---vvv----------------------------------------|mapping        |||file bytes     app

The v's are values from bytes in themapped file. Then, requiredDLL files are mapped (this includes custom libraries as well as system ones such askernel32.dll anduser32.dll):

           0                                           4 GiBVAS        |---vvv--------vvvvvv---vvvv-------------------|mapping        |||        ||||||   ||||file bytes     app        kernel   user

The process then starts executing bytes in the EXE file. However, the only way the process can use or set '-' values in its VAS is to ask the OS to map them to bytes from a file. A common way to use VAS memory in this way is to map it to thepage file. The page file is a single file, but multiple distinct sets of contiguous bytes can be mapped into a VAS:

           0                                           4 GiBVAS        |---vvv--------vvvvvv---vvvv----vv---v----vvv--|mapping        |||        ||||||   ||||    ||   |    |||file bytes     app        kernel   user   system_page_file

And different parts of the page file can map into the VAS of different processes:

           0                                           4 GiBVAS 1      |---vvvv-------vvvvvv---vvvv----vv---v----vvv--|mapping        ||||       ||||||   ||||    ||   |    |||file bytes     app1 app2  kernel   user   system_page_filemapping             ||||  ||||||   ||||       ||   |VAS 2      |--------vvvv--vvvvvv---vvvv-------vv---v------|

OnMicrosoft Windows 32-bit, by default, only2 GiB are made available to processes for their own use.[2] The other2 GiB are used by the operating system. On later 32-bit editions of Microsoft Windows, it is possible to extend the user-mode virtual address space to3 GiB while only1 GiB is left for kernel-mode virtual address space by marking the programs as IMAGE_FILE_LARGE_ADDRESS_AWARE and enabling the/3GB switch in the boot.ini file.[3][4]

On Microsoft Windows 64-bit, in a process running an executable that was linked with/LARGEADDRESSAWARE:NO, the operating system artificially limits the user mode portion of the process's virtual address space to 2 GiB. This applies to both 32- and 64-bit executables.[5][6] Processes running executables that were linked with the/LARGEADDRESSAWARE:YES option, which is the default for 64-bit Visual Studio 2010 and later,[7] have access to more than2 GiB of virtual address space: up to4 GiB for 32-bit executables, up to8 TiB for 64-bit executables in Windows through Windows 8, and up to128 TiB for 64-bit executables in Windows 8.1 and later.[4][8]

Allocating memory viaC'smalloc establishes thepage file as the backing store for any new virtual address space. However, a process can alsoexplicitly map file bytes.

Linux

[edit]

Forx86 CPUs,Linux 32-bit allows splitting the user and kernel address ranges in different ways:3G/1G user/kernel (default),1G/3G user/kernel or2G/2G user/kernel.[9]

See also

[edit]

Notes

[edit]
  1. ^"What is an address space?".IBM. RetrievedMay 5, 2024.
  2. ^"Virtual Address Space".MSDN. Microsoft.
  3. ^"LOADED_IMAGE structure".MSDN. Microsoft.
  4. ^ab"4-Gigabyte Tuning: BCDEdit and Boot.ini".MSDN. Microsoft.
  5. ^"/LARGEADDRESSAWARE (Handle Large Addresses)".MSDN. Microsoft.
  6. ^"Virtual Address Space".MSDN. Microsoft.
  7. ^"/LARGEADDRESSAWARE (Handle Large Addresses)".MSDN. Microsoft.
  8. ^"/LARGEADDRESSAWARE (Handle Large Addresses)".MSDN. Microsoft.
  9. ^"Linux kernel - x86: Memory split".

References

[edit]
  • "Advanced Windows" by Jeffrey Richter, Microsoft Press
Uninterpreted
Numeric
Pointer
Text
Composite
Other
Related
topics
Retrieved from "https://en.wikipedia.org/w/index.php?title=Virtual_address_space&oldid=1289968970"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp