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

 

The summary of virtual memory

 Virtual memory is an addressing scheme implemented in hardware and software that allows non-contigu...
  • hotsolaris
  • hotsolaris
  • 2007年08月09日 09:55
  • 1449

MarkdownSimpleWorld笔记

原作地址:https://github.com/wizardforcel/markdown-simple-world/blob/master/SUMMARY.md 作者:飞龙   换行:上一行打两个空...
  • Cytosine
  • Cytosine
  • 2017年02月02日 23:22
  • 315

初识virtual memory

一、先谈几个重要的东西 virtual memory是一个抽象概念,书上的原文是"an abstraction of main memory known as virtual memory"(参考资...
  • midhillzhou
  • midhillzhou
  • 2016年08月04日 20:10
  • 1151

Virtual Memory(虚拟内存)

转载请注明出处:http://blog.csdn.net/c602273091/article/details/53529384 Why VM VM Translation Some tips18-6...
  • c602273091
  • c602273091
  • 2016年12月09日 01:23
  • 965

virtual memory exhausted:cannot allocate memory

本人在Ubuntu下安装一个应用程序的时候,系统崩溃了是崩溃了。       然后仔细查看了一下,在系统奔溃之前出现了“virtual memory exhausted:cannot allocate...
  • haizimin
  • haizimin
  • 2016年04月19日 20:09
  • 1224

云端Ubuntu:Virtual memory exhausted:Cannot allocate memory

亚马逊云服务器虚拟内存不足怎么增加捏?
  • panglinzhuo
  • panglinzhuo
  • 2015年12月14日 10:59
  • 1420

编译时:virtual memory exhausted: Cannot allocate memory

一、问题        当安装虚拟机时系统时没有设置swap大小或设置内存太小,编译程序会出现virtual memory exhausted: Cannot allocate memory的问题,...
  • taiyang1987912
  • taiyang1987912
  • 2014年12月03日 13:35
  • 16970

PHP源码安装出现virtual memory exhausted: Cannot allocate memory

在编译安装php时日志中出现下错误记录: virtual memory exhausted: Cannot allocate memory在php.net上找到的解决方法,原文链接是:https: ...
  • qq_33371343
  • qq_33371343
  • 2016年06月20日 12:19
  • 512

编译安装php时遇到virtual memory exhausted: Cannot allocate memory

编译安装php时遇到virtual memory exhausted: Cannot allocate memory 有时候用vps建站时需要通过编译的方式来安装主机控制面板。对于大内存的V...
  • ekecao
  • ekecao
  • 2013年12月09日 14:36
  • 3488

编译QT程序出现virtual memory exhausted: Cannot allocate memory

编译QT程序出现virtual memory exhausted: Cannot allocate memory    内存被耗尽了。
  • u010842812
  • u010842812
  • 2014年05月24日 10:19
  • 892
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Simple summary of virtual memory
举报原因:
原因补充:

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