Simple summary of virtual memory

原创 2011年01月08日 17:21:00

Search some materials on the internet and books. Review the knowledge and make a simple summary.

1 Virtual memory

Virtual memory is a memory management technology for modern multitasking operating system. Processes do not get the physical memory directly. Each process runs on its own virtual memory which is automatically translated into real memory by operating system and hardware.

The application program thinks it has a large range of continuous address space. In reality, the parts it is currently using are scattered around the RAM, and the inactive parts are saved in hard disk. No matter how much the physical memory is in a computer, the amount of virtual memory space in a 32 bit system is always 4GB .

 

The virtual address space starts at zero. It is composed of many fixed size pages. It includes Text, Data, BSS, Heap, and Stack at least. The heap and stack can shrink or grow.

 

A simple example

 

char courty = “China”; [global var. “China” is Text and read-only data]

int prvNum; [Not initialized, BSS]

char * fun(void){

char * p; [local var; Stack]

prvNum = 33;

p = malloc(prvNum); [Heap;dynamic memory]

return p;

}

 

2. page


Page is a fixed-length block of main memory. It is continuous in both physical memory addressing space and

 

virtual memory addressing space. A page is usually the smallest unit of data for the following:

  1. Memory allocation performed by the operating system for a program

  2. transfer between main memory and any other auxiliary store.

 

Two-level page table structure

  There are many sub tables that cover all the virtual address space. A master table convers all sub tables. An address refers to the master table. The virtual address is divided into three parts. See the next picture. Using multi-level page table structure accelerates the searching speed. I call the idea as classification.

 

Other examples: army organization; a book content table and contents.

 

Reference:

http://en.wikipedia.org/wiki/Dynamic_memory_allocation

http://members.shaw.ca/bsanders/WindowsGeneralWeb/RAMVirtualMemoryPageFileEtc.htm

http://www.cs.princeton.edu/courses/archive/spr04/cos217/lectures/Memory.pdf

 

相关文章推荐

解决running beyond virtual memory limits. Current usage: 35.5 MB of 1 GB physical memory used; 16.8 G

[root@S1PA124 mapreduce]# hadoop jar hadoop-mapreduce-examples-2.2.0.jar wordcount /input /output 14...

Open-Source Virtual Reality --- summary1

Open-Source Virtual Reality --- summary1

summary of design patterns

  • 2009年10月31日 07:56
  • 1.09MB
  • 下载

Summary_of_Changes_OCP_chinese

  • 2012年10月09日 15:25
  • 115KB
  • 下载

A summary of Change in systemverilog 2012

ref:http://www.sutherland-hdl.com/papers/2012-DAC_What-is-new-in-SystemVerilog-2012.pdf (只提取一些目前自己感...

pci_dss_v2_summary_of_changes.pdf

  • 2011年01月09日 17:19
  • 397KB
  • 下载

Introduction to Algorithm - Summary of Chapter 8 - Sorting in Linear Time

算法导论课后习题解析 第八章 算法导论课后总结 第八章
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Simple summary of virtual memory
举报原因:
原因补充:

(最多只允许输入30个字)