免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4906 | 回复: 3
打印 上一主题 下一主题

[系统管理] 怎样理解AIX内存(MEMORY)和页空间(PAGE SPACE)[WINDOWS上叫虚存]的管理 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-08-27 12:03 |只看该作者 |倒序浏览
本帖最后由 树袋熊 于 2010-08-27 13:07 编辑

看到个通俗易懂的文章,给翻译粘贴如下, 给AIX新生和我自己:

Data is essentially held in pages of 4096b, and a page in RAM is accessible by the CPU, if the page is on disk the CPU can't access it directly.
数据是按每页4096b的方式排放的,如果这些数据页在内存中CPU可以直接访问,如果在硬盘上就不能够直接访问了.
A page fault occurs when a wanted page address does not translate to a real memory
address.  At this point the Virtual Memory Manager (VMM)knows it needs to get data from disk and place it in RAM - it therefore checks to see that there is space in RAM in which to out this data.
当要访问的数据页地址不能翻译成内存地址时(就是说你不能在内存中找到相关的数据时),PAGE FAULT就发生了.这意味着VMM(虚存管理器)知道自己要从硬盘上拿数据并放在内存里面,于是它要检查内存是否有空间来放这个数据(页).

If there's enough room, VMM checks to see if the wanted page has been used previously by this process:
如果空间足够,VMM就去检查是否这个数据页被以前的进程使用过:

- if not, an "initial page fault", VMM allocates _two_ pages for the data; one in RAM and the other on a backing page on disk where it can go if it has to be temporarily removed from RAM. This is known as "late page space allocation".
-        如果这个数据页没有被以前的进程使用过,”初始PAGE FAULT”就会发生,VMM会分配两个页来存放这个数据页,一个在内存中,另一个放在硬盘上以备将来内存页上的数据被临时删除后会用到.

- if it has, a "repage fault" I/O is scheduled to bring the data back from disk and into RAM - the act of resolving this repage fault is called a "page-in" (the process that is waiting for this to happen is in a "page wait state").
-如果这个数据页以前被使用过,”REPAGE FAULT” I/O操作就会被安排来把硬盘上的数据放到内存中,这个操作也叫”PAGE IN”,等待这个PAGE IN 的进程的状态会处于”PAGE WAIT STATE”
So what happens if there's not enough room in RAM to put the page? Well the page stealer is there to ensure that there is a supply of free RAM pages available for an initial page fault. If the number of free RAM pages drops below a specified value then the page stealer will try and get some pages back. It keeps on stealing pages until it reaches an upper limit.
那么如果没有足够内存来放数据页怎么办呢?有个东西叫”PAGE STEALER”来保证”初始PAGE FAULT”能够发生.这个”PAGE STEALER”通过”STEAL PAGE”(偷页)来获得一定的空闲内存页空间,当你的空闲内存页低于某个值时它开始操作,直到达到某个阀值时操作停止.
So how does it decide which pages to steal? The page stealer will select the least recently used, or LRU, pages. If the page has been modified in RAM it's classed as a dirty page and is put to a backing store (either page space or a filesystem); if it's clean (the copy in RAM matches the copy in page space) then the RAM page is purged.
那么它是如何决定去”偷”那个页呢?”PAGE STEALER”选中最新使用过的页,如果这个页在内存中被改动过并被标记成为赃页并被放到后被设备上,或者这个页是干净的就是说内存中和后备设备中页是匹配的..

Note that the page space is used for non-persistent or working pages, and the filesystem is used for persistent or file pages.
注意页空间是给用作非永久(临时)的页或工作页,而文件系统是被用做永久的页面或文件页. [这里我理解了但是翻译的有点问题,不知道该如何表达]

There is, of course, a basic assumption here that all stale pages are treated equally, i.e. whether it's a file- or nonfile- page makes no difference to the page stealer.
当然对上面的说法我们基本的假设就是对”PAGE STEALER”来说这些(要偷的)STALE PAGES[坏页]它们是没有区别的.


However this is not the case.  Increased paging activity makes VMM act upon the different types of (stale) pages in a different manner.  When the number of [stale] file pages exceed a number - set by the maxperm threshold - the page stealer will steal only file pages.
但实际情况会有些不同,当(要偷的)STALE PAGES(坏页)超过一个限额-MAXPERM时,VMM就会让(PAGE STEALER)只偷文件页.

If the number of stale file pages is below maxperm (but above the set minperm threshold) then two other considerations come into play.
当坏文件页在显额MAXPERM和MINPERM之间是,就会有下面两种考虑了.


The VMM checks the repage rates of both file and nonfile pages, and will steal file pages if the file page repage rate is higher than the repage rate for nonfiles.
VMM要检查文件页和非文件页的RAPAGE RATE(页重置率),如果文件页的重置率比非文件页的高就偷文件页.

If this not the case then both types of pages are treated as equal victims.
如果文件页重置率低就同样对待.

[关于页重置率:
PAGE FAULT可以是个新的PAGE FAULT,也可以是个REPAGE FAULT.出现新的PAGE FAULT是指第一次调用,最近没有相关的记录.出现REPAGE FAULT是指当刚刚调用过但是已经被替换出去了(很可能写回磁盘了),再次调用.发生一次PAGE FAULT 正常,但是发生多次就要避免].

PERFORMANCE HITS / ACTUAL DISK I/O...
性能影响/实际磁盘I/O

To understand the performance hit of the paging figures that you come across, you need to realise that page faults do NOT (necessarily) result in disk activity.  Remember from above that only the repage fault - the act of bringing back previously used data into memory - causes disk I/O to be scheduled.
理解页处理对性能的影响可以让你把上面的东西贯穿起来,你应该知道PAGE FAULT并不导致磁盘读写.只有REPAGE FAULT 把以前的数据放入内存会引起磁盘I/O的需要.

Page out I/O only occurs when a page is stolen by the page stealer AND is marked as 'dirty'.  This only happens when there is a shortage of free RAM pages. Hence the page-out figure can be an indicator of how memory constrained the system is.  The vmstat command is only of limited use as it just reports activity concerned with page space (and not paging to/from filesystem space).
PAGE OUT 只在PAGE STEALER 偷页 并被标记为”赃”页时才发生,而且只在缺少内存时.因此PAGE OUT的特点可以是系统内存紧张的一个标志. VMSTAT 命令很有限因为它只是报告虚存PAGE SPACE有关的东西而不是文件系统空间的页出或入.

If the system consistently appears to hover around the minperm value (the "fre" column in vmstat) then it does not follow that the system is memory constrained - consider the scenario where an initial page fault is resolved by purging a clean, but stale, page.  In this there is paging activity but no corresponding I/O.

如果系统连续的出现围绕MINPERM的FRE值(VMSTAT 命令中FRE 列), 这并不是说系统内存紧张,想想初始PAGE FAULT是被刷新一个干净页而不是用坏页来解决.这里有个页面操作但是没有I/O操作.

System performance may be improved by reducing the amount of RAM that file pages occupy - this ensures that working pages are not continually being pushed out to make way for file pages.
系统性能可能被通过减少文件页来得到提高,这样可以保证工作页不会被连续给文件页强占位置.

This can be achieved through the use of the vmtune command (/usr/samples/kernel) and DECREASING values for minperm and maxperm.
我们同过用vmtune command (/usr/samples/kernel)和减少MINPERM和MAXPERM来实现.

PAGING SPACE
页空间(WINDOWS上叫虚存)

So how much page space do I need?  For systems that have up to 256MB of real memory, use the well known formula...
我们需要用多少页空间呢?著名的256M内存的公式如下:

page_space = 2 x real_memory

...for those systems with more than 256MB of real memory use...
大于256的呢?

page_space = 512MB + (real_memory - 256MB) * 1.25

The following should also be adhered to where possible:
也要考虑下面几点:
1. configure just one paging space per disk
一个磁盘一块页空间


2. use between 2 and 6 paging spaces in a medium size system
中型系统2-6块页空间
3. configure the paging spaces on each disk to be the same size
每个磁盘上的页空间大小相同.
That's about it really - all you never needed to know about paging space and VMM.
……
Dave V.
树袋熊翻译.


下午回来再更正

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2010-08-27 12:40 |只看该作者
paging space翻成换页空间比较好,翻译成虚存是windows习惯把

VMM就是虚拟内存管理器,cpu跟VMM打交道,而VMM负责和物理内存和换页空间(DISK)打交道,VMM是多出来的一个虚拟层面,使得整个内存管理更清晰透明

BTW,还有个VFS的,也是一个虚拟的层面,os负责和vfs打交道,vfs负责和各种卷管理器,disk打交道

虚拟,真的是无处不在

论坛徽章:
0
3 [报告]
发表于 2010-08-27 13:01 |只看该作者
谢谢打酱油地, 改成页空间了,偶还真没有注意这个用字区别,以前看他们翻译的AIX文档还真用了这个虚存,所以偶也套用了.

论坛徽章:
0
4 [报告]
发表于 2010-08-27 17:00 |只看该作者
390也叫虚存
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP