Virtual memory: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Pat Palmer
(additiona verbiage in opening paragraph, still needs work)
imported>Pat Palmer
(more about marketplace and importance of VM)
Line 1: Line 1:
{{subpages}}
{{subpages}}
'''Virtual memory''' is an important concept in [[computer science]] that lets a program use more memory than is physically available for it. The [[operating system]] will keep the needed parts of the program's memory in main memory, and put the parts that are not currently used on the disk. The parts on the disk will then be swapped into memory as needed. The concept of virtual memory was first described by Fotheringham in 1961<ref>John Fotheringham. ''Dynamic storage allocation in the Atlas computer, including an automatic use of a backing store'', in Communications of the ACM,  Volume 4 ,  Issue 10  (October 1961). Pages: 435 - 436  ([http://portal.acm.org/citation.cfm?doid=366786.366800# ACM])</ref>.  The operating system typically receives substantial help in performing virtual memory page management via special features of the computer hardware.  The mechanisms for virtual memory swapping are transparent to users, but are very complex and constitute an enormous amount of learning and specialization in the field of [[computer architecture]] and hardware and operating systems design.  
'''Virtual memory''' is an important concept in [[computer science]] that lets a program use more memory than is physically available for it. The [[operating system]] will keep the needed parts of the program's memory in main memory, and put the parts that are not currently used on the disk. The parts on the disk will then be swapped into memory as needed. The concept of virtual memory was first described by Fotheringham in 1961<ref>John Fotheringham. ''Dynamic storage allocation in the Atlas computer, including an automatic use of a backing store'', in Communications of the ACM,  Volume 4 ,  Issue 10  (October 1961). Pages: 435 - 436  ([http://portal.acm.org/citation.cfm?doid=366786.366800# ACM])</ref>.  The mechanisms for virtual memory swapping are, for the most part, transparent to users, who may use the computer as if it really had the larger amount of virtual memory rather than the smaller amount of physical memory.


There are two components in virtual memory. The first part is exactly equal to the amount of real memory, and is physically stored in in real memory. The second part is the space having addresses above the real memory. This part is stored on a external paging device, usually a [[hard disk]].<ref>W. S. Davies and T. M. Rajkumar. ''Operating Systems: A systematic view''. Pearson Education, 2005. Page 127</ref>.  
There are two components in virtual memory. The first part is exactly equal to the amount of real memory, and is physically stored in in real memory. The second part is the space having addresses above the real memory. This part is stored on a external paging device, usually a [[hard disk]].<ref>W. S. Davies and T. M. Rajkumar. ''Operating Systems: A systematic view''. Pearson Education, 2005. Page 127</ref>.   A special part of a computer's hardware, usually called the [[memory management unit]], helps the [[operating system]] perform the mapping between physical memory and ''virtual'' memory, and then efficiently move hunks of programs back on forth between physical memory and disk as needed.  Implementations of virtual memory are complex and result from an enormous amount of learning and specialization in the field of [[computer architecture]] and hardware and operating systems design. 


== Paging ==
== Paging ==


Most virtual memory systems use a technique called paging. The virtual address space is divided into units called pages, and the corresponding units in physical memory are called page frames. Transfers between main memory and the external paging device are always in units of a page. A virtual address is mapped to a physical address by a Memory Management Unit (MMU)<ref>Andrew S. Tannenbaum. ''Modern Operating Systems''. Prentice-Hall 2001. Page 202-203</ref>. When pages are pulled from swap space back into main memory this is called a 'page fault.'
Most virtual memory systems use a technique called paging. The virtual address space is divided into units called pages, and the corresponding units in physical memory are called page frames. Transfers between main memory and the external paging device are always in units of a page. A virtual address is mapped to a physical address by a Memory Management Unit (MMU)<ref>Andrew S. Tannenbaum. ''Modern Operating Systems''. Prentice-Hall 2001. Page 202-203</ref>. When pages are pulled from swap space back into main memory this is called a 'page fault.'
==What can go wrong?==
Situations can arise where the computer ends up using a majority of its computing power in moving hunks of programs and data onto disk and back into memory.  This situation is called [[thrashing]], and the only way out of it is to cause some programs to stop running (usually by rebooting the computer). 
==Performance and cost issues==
Virtual memory works with mechanisms that are similar to [[cache memory]], but for very different reasons.  There are also complex interdependencies between virtual memory implementations and cache memory implementations.  These implementations may contribute more to the overall [[throughput]] of a computer than the actual processor speeed, because disk operations are much slower than computations being done in the processer (by an order of magnitude).  As a rule of thumb, this means that a user may get a faster computer, in some cases, simply by having more memory (and especially cache memory) than by installing a faster processor.
A substantial portion of the design effort in specifying computer instruction set architectures, and in implementing hardware that runs them, has to be devoted to these complex memory management issues.  Likewise, a substantial portion of computer [[operating system]] design effort must necessarily go into the virtual memory and cache related operations.
The specifications advertised on commercial computers usually place a higher emphasis on processor speed than memory, and often, the a lay user, the cache memory sizes and other related specifications are not even advertised, which makes sense because they are so little understood by people in general.  In fact, manufacturers may be rather protective or secretive about the exact ways in which virtual memory and caching are done on a specific computer, because this is one of the ways in which a computer can appear to run faster than other computers (hence, the information may be treated as proprietary in the marketplace).


== References ==
== References ==
<references />
<references />

Revision as of 13:22, 16 January 2008

This article is a stub and thus not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.

Virtual memory is an important concept in computer science that lets a program use more memory than is physically available for it. The operating system will keep the needed parts of the program's memory in main memory, and put the parts that are not currently used on the disk. The parts on the disk will then be swapped into memory as needed. The concept of virtual memory was first described by Fotheringham in 1961[1]. The mechanisms for virtual memory swapping are, for the most part, transparent to users, who may use the computer as if it really had the larger amount of virtual memory rather than the smaller amount of physical memory.

There are two components in virtual memory. The first part is exactly equal to the amount of real memory, and is physically stored in in real memory. The second part is the space having addresses above the real memory. This part is stored on a external paging device, usually a hard disk.[2]. A special part of a computer's hardware, usually called the memory management unit, helps the operating system perform the mapping between physical memory and virtual memory, and then efficiently move hunks of programs back on forth between physical memory and disk as needed. Implementations of virtual memory are complex and result from an enormous amount of learning and specialization in the field of computer architecture and hardware and operating systems design.

Paging

Most virtual memory systems use a technique called paging. The virtual address space is divided into units called pages, and the corresponding units in physical memory are called page frames. Transfers between main memory and the external paging device are always in units of a page. A virtual address is mapped to a physical address by a Memory Management Unit (MMU)[3]. When pages are pulled from swap space back into main memory this is called a 'page fault.'

What can go wrong?

Situations can arise where the computer ends up using a majority of its computing power in moving hunks of programs and data onto disk and back into memory. This situation is called thrashing, and the only way out of it is to cause some programs to stop running (usually by rebooting the computer).

Performance and cost issues

Virtual memory works with mechanisms that are similar to cache memory, but for very different reasons. There are also complex interdependencies between virtual memory implementations and cache memory implementations. These implementations may contribute more to the overall throughput of a computer than the actual processor speeed, because disk operations are much slower than computations being done in the processer (by an order of magnitude). As a rule of thumb, this means that a user may get a faster computer, in some cases, simply by having more memory (and especially cache memory) than by installing a faster processor.

A substantial portion of the design effort in specifying computer instruction set architectures, and in implementing hardware that runs them, has to be devoted to these complex memory management issues. Likewise, a substantial portion of computer operating system design effort must necessarily go into the virtual memory and cache related operations.

The specifications advertised on commercial computers usually place a higher emphasis on processor speed than memory, and often, the a lay user, the cache memory sizes and other related specifications are not even advertised, which makes sense because they are so little understood by people in general. In fact, manufacturers may be rather protective or secretive about the exact ways in which virtual memory and caching are done on a specific computer, because this is one of the ways in which a computer can appear to run faster than other computers (hence, the information may be treated as proprietary in the marketplace).

References

  1. John Fotheringham. Dynamic storage allocation in the Atlas computer, including an automatic use of a backing store, in Communications of the ACM, Volume 4 , Issue 10 (October 1961). Pages: 435 - 436 (ACM)
  2. W. S. Davies and T. M. Rajkumar. Operating Systems: A systematic view. Pearson Education, 2005. Page 127
  3. Andrew S. Tannenbaum. Modern Operating Systems. Prentice-Hall 2001. Page 202-203