1:内存管理
2:衡量内存闲忙程度的指标
3:内存资源成为系统性能的瓶颈的征兆
4:什么地方/哪些进程是占用内存资源的大户?
5:利用vmstat命令分析内存的利用率
6:利用ipcs分析消息队列、共享内存和信号量
7:利用GlancePlus分析系统内存资源利用率
8:对内存需求密集型系统的性能调试
内存管理
1)内存管理的主要工作:
跟踪内存的使用和可用内存的情况;
为进程分配内存;
管理磁盘与物理内存之间的换页(paging);
2)什么是虚拟内存(virtual memory)?
virtual memory uses a disk as an extension of RAM so that the effective size of usable memory grows correspondingly. The kernel will write the contents of a currently unused block of memory to the hard disk so that the memory can be used for another purpose. When the original contents are needed again, they are read back into memory. This is all made completely transparent to the user; programs only see the larger amount of memory available and don"t notice that parts of them reside on the disk from time to time. Of course, reading and writing the hard disk is slower (on the order of a thousand times slower) than using real memory, so the programs don"t run as fast. The part of the hard disk that is used as virtual memory is called the swap space.
物理内存(physical memory)
swap space:
3)paging
A technique by which the contents of a virtual memory address(called pages) are moved from virtual memory(the disk)into and out of the main memory where it is accessed by the CPU.
这个机制是由一个叫vhand的进程来完成 。
当可用内存的数量小于LOTSFREE时,例程pageout将被调用来选择什么内存可以释放 。它采用two-handed clock algorithm,the reference hand turn off the reference bit of each memory page it references.If the refernce bit is still zero when the second hand gets to it,the page is freed.If the page is clean(unmodifIEd),it is added to the freelist.If the page is dirty,it must be posted to the swap device before being put on the freelist.
lotsfree: based on physical memory (64 MB -> 863) upper bound where paging starts/stops
desfree: based on physical memory (64 MB -> 215)lower bound where paging starts/stops
minfree: based on physical memory (64 MB -> 53) threshold where deactivation starts
4)Page fault
An invalid address error(trap)that occurs when the CPU requests a page from memory that has not been paged in from the disk(virtual memory)to the main memory. The page may also have been paged out from the main memory prior the request.
5)Process Deactivaton
Deactivating a process so its memory pages will be flagged free or paged out rapidly by vhand.
6)Thrashing
A situation in which a process is spending more time paging than processing;a high number of page faults is occuring.
7)Buffer Cache
它是内存的一部分,用于加快文件存取时间;
缓存的大小可以随可用内存动态变化,但也可以通过修改内核参数而改成固定的大小;
缓存可以提高磁盘的读/写性能;
在缓存的内容可以通过sync进程来强制写入磁盘;
从缓存的读和写又称为逻辑读和逻辑写;
8)内存需求
按用途来分,内存可以分成两部分:预留内存和动态内存 。
预留内存主要用于存放:
system table
data structures
buffer cache
其中系统表和数据结构占用的数量一般很小,但缓存则可能占到很大一部分 。
动态内存主要用于存放:
process text
data stack
share memory segments
其中各进程锁定的内存会影响动态内存的大小 。
衡量内存闲忙程度的指标
1)整体内存忙闲指标:
buffer cache size: 缓存区在内存开销中占很大比例;
page in/out rates;
swap in/out rates;
可用内存的大小,或用得到内存的大小(available memory size):
推荐阅读
- 梓潼县属于哪个市
- 二十四桥的月亮,又照着谁的心事,写作无字诗行 二十四桥的月亮又照着谁的心事写作无字诗行什么意思
- 第四章:软件包管理 Solaris系统管理培训
- 出马仙四梁八柱是什么
- 红薯施肥四个误区要避开
- 谁位于福建东南唐朝时为世界四大口岸之一 哪座城市在唐朝成为世界四大口岸之一
- 一 性能调试---性能分析准则
- 纸箱底部四片怎么折叠牢固
- 华为p30中开启usb调试的操作教程
- 三 性能调试---CPU性能分析