Virtual address space

Virtual address space

Virtual address space (abbreviated VAS) is a memory mapping mechanism available in modern operating systems such as OpenVMS, UNIX, Linux, and Windows NT.

Overview

Virtual memory is easiest to comprehend if one thinks in terms of the VAS, and not the physical memory of the machine nor the size of its page file. Byte values in the VAS come "only" from byte values in a file. The OS manages the mapping between the VAS and the files that hold its values.

Each time an application is run in an operating system (OS), the OS creates a new process and a new VAS for this process.

Physical memory comes in various flavors: on-chip cache, off-chip cache, and system memory. As far as the process is concerned, system memory is just another level of cache used by the OS. System memory has a lot to do with performance, but nothing to do with the architecture of a process. The process architecture is based on the VAS. Physical memory is used by the OS to map values from file bytes to VAS addresses: process memory is VAS memory, not physical memory.

Example

:"In the following description, the terminology used will be particular to the Windows NT OS, but the concepts are applicable to other virtual memory operating systems"

When you run a new application in a 32-bit OS, the process has a 4 GB VAS: each one of the memory addresses (from 0 to 232-1) in that space can have a single byte as value. Initially, none of them have values ('-' represents no value). Using or setting values in such a VAS would cause a memory exception.

0 4GB VAS |----------------------------------------------

Then the application's EXE 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 4GB VAS |---vvvvvvv------------------------------------
mapping |-----
file bytes app.exe

The v's are values from bytes in the mapped file. Then, required DLL files are mapped (this includes custom libraries as well as system ones such as kernel32.dll and user32.dll):

0 4GB VAS |---vvvvvvv----vvvvvv---vvvv-------------------
mapping ||||||| |||||| |||
file bytes app.exe 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 4GB VAS |---vvvvvvv----vvvvvv---vvvv----vv---v----vvv--
mapping ||||||| |||||| |||| || | ||
file bytes app.exe kernel user system_page_file

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

0 4GB 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------

Allocating memory via system calls such as C's malloc implicitly maps bytes of thepage file into the VAS. However, a process can also "explicitly" map file bytes.

References

*"Advanced Windows" by Jeffrey Richter, Microsoft Press


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Kernel virtual address space — The Kernel Virtual Address Space (KVA) is the virtual memory area in which all Linux kernel threads reside. The second part of the virtual address space is occupied by the User Virtual Address Space which contain user threads …   Wikipedia

  • Address space — In computing, an address space defines a range of discrete addresses, each of which may correspond to a physical or virtual memory register, a network host, peripheral device, disk sector or other logical or physical entity. A memory address… …   Wikipedia

  • Address space layout randomization — (ASLR) is a computer security technique which involves randomly arranging the positions of key data areas, usually including the base of the executable and position of libraries, heap, and stack, in a process s address space. Benefits Address… …   Wikipedia

  • Single address space operating system — In computer science, a single address space operating system (or SASOS) is a type of operating system with simple memory management which uses only one globally shared virtual address space. List of SASOS Projects * Angel * BMX *… …   Wikipedia

  • address space — noun A range of discrete addresses, all the address locations available in a particular, named, subset of a computers (virtual or real) memory …   Wiktionary

  • Virtual memory/rewrite — Virtual memory is a computer system technique that gives an application program the impression it has contiguous working memory, while in fact it is physically fragmented and may even overflow on to disk storage. Systems which use this technique… …   Wikipedia

  • Address Windowing Extensions — (AWE) is a Microsoft Windows Application Programming Interface that allows a 32 bit software application to access more physical memory than it has virtual address space. The process of mapping an application s virtual address space to physical… …   Wikipedia

  • Space (disambiguation) — Space is a framework from which we can quantify distances between objects or points. Space or spacing may also refer to:In science:* Outer space, the area beyond the limit of the Earth s atmosphere * a mathematical space is an informal term for… …   Wikipedia

  • Virtual memory — This article is about the computational technique. For the TBN game show, see Virtual Memory (game show). Virtual memory combines active RAM and inactive memory in disk form into a large range of contiguous addresses. In computing, virtual memory …   Wikipedia

  • Virtual private network — A virtual private network (VPN) is a computer network in which some of the links between nodes are carried by open connections or virtual circuits in some larger network (e.g., the Internet) instead of by physical wires. The link layer protocols… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”