Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Virtual address space
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Set of ranges of virtual addresses}} {{redirect2|Virtual address|virtual addressing}} {{one source|date=August 2012}} [[Image:Virtual address space and physical address space relationship.svg|thumb|300px]] In [[computing]], a '''virtual address space''' ('''VAS''') or '''[[address space]]''' is the set of ranges of virtual addresses that an [[operating system]] makes available to a process.<ref>{{cite web|website=IBM|title=What is an address space?|url=https://www.ibm.com/docs/en/zos-basic-skills?topic=storage-what-is-address-space|access-date=May 5, 2024}}</ref> The range of virtual addresses usually starts at a low address and can extend to the highest address allowed by the computer's [[Instruction set|instruction set architecture]] and supported by the [[operating system]]'s pointer size implementation, which can be 4 [[bytes]] for [[32-bit]] or 8 [[bytes]] for [[64-bit]] OS versions. This provides several benefits, one of which is security through [[process isolation]] assuming each process is given a separate [[address space]]. == Example == :''In the following description, the terminology used will be particular to the [[Windows NT]] operating system, but the concepts are applicable to other [[virtual memory]] operating systems.'' When a new application on a [[32-bit]] OS is executed, the process has a {{nowrap|4 [[Gibibyte|GiB]]}} VAS: each one of the [[memory address]]es (from 0 to 2<sup>32</sup> β 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 a [[Page fault|memory exception]]. 0 4 GiB VAS |----------------------------------------------| 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 GiB VAS |---vvv----------------------------------------| mapping ||| file bytes app The v's are values from bytes in the [[memory-mapped file|mapped file]]. Then, required [[Dynamic-Link Library|DLL]] files are mapped (this includes custom libraries as well as system ones such as <code>kernel32.dll</code> and <code>user32.dll</code>): 0 4 GiB VAS |---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 the [[page file]]. The page file is a single file, but multiple distinct sets of contiguous bytes can be mapped into a VAS: 0 4 GiB VAS |---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 GiB VAS 1 |---vvvv-------vvvvvv---vvvv----vv---v----vvv--| mapping |||| |||||| |||| || | ||| file bytes app1 app2 kernel user system_page_file mapping |||| |||||| |||| || | VAS 2 |--------vvvv--vvvvvv---vvvv-------vv---v------| On [[Microsoft Windows]] 32-bit, by default, only {{nowrap|2 GiB}} are made available to processes for their own use.<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/aa366912(VS.85).aspx|title=Virtual Address Space|publisher=Microsoft|work=[[MSDN]]}}</ref> The other {{nowrap|2 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 to {{nowrap|3 GiB}} while only {{nowrap|1 GiB}} is left for kernel-mode virtual address space by marking the programs as IMAGE_FILE_LARGE_ADDRESS_AWARE and enabling the {{code|/3GB}} switch in the boot.ini file.<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/ms680349(v=VS.85).aspx|title=LOADED_IMAGE structure|publisher=Microsoft|work=[[MSDN]]}}</ref><ref name="4gbtuning"/> On Microsoft Windows 64-bit, in a process running an executable that was linked with {{code|/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.<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/wz223b1z%28v=VS.100%29.aspx|title=/LARGEADDRESSAWARE (Handle Large Addresses)|publisher=Microsoft|work=[[MSDN]]}}</ref><ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/aa384271%28VS.85%29.aspx|title=Virtual Address Space|publisher=Microsoft|work=[[MSDN]]}}</ref> Processes running executables that were linked with the {{code|/LARGEADDRESSAWARE:YES}} option, which is the default for 64-bit Visual Studio 2010 and later,<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/wz223b1z(v=vs.100).aspx|title=/LARGEADDRESSAWARE (Handle Large Addresses)|publisher=Microsoft|work=[[MSDN]]}}</ref> have access to more than {{nowrap|2 GiB}} of virtual address space: up to {{nowrap|4 GiB}} for 32-bit executables, up to {{nowrap|8 TiB}} for 64-bit executables in Windows through Windows 8, and up to {{nowrap|128 TiB}} for 64-bit executables in Windows 8.1 and later.<ref name="4gbtuning">{{cite web|url=https://msdn.microsoft.com/en-us/library/bb613473(v=VS.85).aspx|title=4-Gigabyte Tuning: BCDEdit and Boot.ini|publisher=Microsoft|work=[[MSDN]]}}</ref><ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/wz223b1z(VS.80).aspx|title=/LARGEADDRESSAWARE (Handle Large Addresses)|publisher=Microsoft|work=[[MSDN]]}}</ref> Allocating memory via [[C (programming language)|C]]'s [[malloc]] establishes the page file as the backing store for any new virtual address space. However, a process can also [[memory-mapped file|explicitly map]] file bytes. == Linux == For [[x86]] CPUs, [[Linux]] 32-bit allows splitting the user and kernel address ranges in different ways: ''3G/1G user/kernel'' (default), ''1G/3G user/kernel'' or ''2G/2G user/kernel''.<ref>{{cite web|url=https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/Kconfig#n1446|title=Linux kernel - x86: Memory split}}</ref> == See also == * [[Linear address space]] * [[Single address space operating system]] == Notes == {{reflist}} == References == * "'''Advanced Windows'''" by Jeffrey Richter, Microsoft Press {{Data types}} [[Category:Virtual memory]] [[de:Virtueller Adressraum]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:Data types
(
edit
)
Template:Nowrap
(
edit
)
Template:One source
(
edit
)
Template:Redirect2
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)